 //將HTML表格的每行每列轉(zhuǎn)為數(shù)組,采集表格數(shù)據(jù) <? function get_td_array($table) { $table = preg_replace("'<table[^>]*?>'si","",$table);
//開源代碼OSPhP.COm.CN
$table = preg_replace("'<tr[^>]*?>'si","",$table); $table = preg_replace("'<td[^>]*?>'si","",$table); $table = str_replace("</tr>","{tr}",$table);
//OSPHP.COM.Cn開源
$table = str_replace("</td>","{td}",$table); //去掉 HTML 標(biāo)記 $table = preg_replace("'<[/!]*?[^<>]*?>'si","",$table); //OSPHP.COm.CN //去掉空白字符 $table = preg_replace("'([rn])[s]+'","",$table); $table = str_replace(" ","",$table); //開源代碼OSPHP.COM.Cn $table = str_replace(" ","",$table); $table = explode('{tr}', $table); array_pop($table); //開源代碼OSPHP.COM.Cn foreach ($table as $key=>$tr) { $td = explode('{td}', $tr); array_pop($td); $td_array[] = $td; //開源OSPhP.COM.CN } return $td_array; }
?>
 //返回字符串中的所有單詞 $distinct=true 去除重復(fù) <? function split_en_str($str,$distinct=true) { preg_match_all('/([a-zA-Z]+)/',$str,$match);
//開源代碼OSPhP.COm.CN
if ($distinct == true) { $match[1] = array_unique($match[1]); } sort($match[1]); //開源代碼OSPHP.COM.Cn return $match[1]; } ?>
 //打印出為本PHP項目做出貢獻(xiàn)的人員的清單 <? string phpcredits(void)
?>
|