//HTML表格的每行转为CSV格式数组 function get_tr_array($table) { $table = preg_replace("'<td[^>]*?>'si",'"',$table); $table = str_replace("</td>",'",',$table); $table = str_replace("</tr>","{tr}",$table); //去HTML 标记 $table = preg_replace("'<[\/\!]*?[^<>]*?>'si","",$table); //去空白字符 $table = preg_replace("'([\r\n])[\s]+'","",$table); $table = str_replace(" ","",$table); $table = str_replace(" ","",$table); $table = explode(",{tr}",$table); array_pop($table); return $table; }