<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_17525"> HTML表格的每行转为CSV格式数组 <div class="blockcode"> <div id="code_qVE"><ol> <li>//HTML表格的每行转为CSV格式数组 </li> <li><? <li>function get_tr_array($table) {<li>//PHP开源代码<li>$table = preg_replace("'<td[^>]*?>'si",'"',$table); </li> <li>$table = str_replace("</td>",'",',$table); </li> <li>$table = str_replace("</tr>","{tr}",$table); //开源代码OSPhP.COm.CN </li> <li>//去掉 HTML 标记 </li> <li>$table = preg_replace("'<[/!]*?[^<>]*?>'si","",$table); </li> <li>//去掉空白字符 </li> <li>$table = preg_replace("'([rn])[s] '","",$table);</li> <li>//开源代码OSPhP.COm.CN</li> <li>$table = str_replace(" ","",$table); </li> <li>$table = str_replace(" ","",$table); </li> <li>$table = explode(",{tr}",$table);</li> <li>//开源代码OSPHP.COM.Cn</li> <li>array_pop($table); </li> <li> return $table; </li> <li>} </li> <li>?></li> </ol></div> <em onclick="copycode($('code_qVE'));">复制代码</em> </div> </td></tr></table> <div id="comment_17525" class="cm"> </div> <div id="post_rate_div_17525"></div> <br><br>