php php採集程式中常用的函式

2021-09-01 07:36:30 字數 1889 閱讀 3843

php採集程式中常用的函式

//獲得當前的指令碼**

function get_php_url()else

return $nowurl;

}//把全形數字轉為半形數字

function getalabnum($fnum)","",$fnum);

if($fnum=="") $fnum=0;

return $fnum;

}//去除html標記

function text2html($txt)/isu","

\r\n",$txt);

return $txt;

}//清除html標記

function clearhtml($str)

//相對路徑轉化成絕對路徑

function relative_to_absolute($content, $feed_url)

if (isset($protocol[0])) else

return $new_content;

}//取得所有鏈結

function get_all_url($code)

//獲取指定標記中的內容

function get_tag_data($str, $start, $end)

$str = explode($start, $str);

$str = explode($end, $str[1]);

return $str[0];

}//html**的每行轉為csv格式陣列

function get_tr_array($table) ",$table);

//去掉 html 標記

$table = preg_replace("'<[\/\!]*?[^<>]*?>'si","",$table);

//去掉空白字元

$table = preg_replace("'([\r\n])[\s]+'","",$table);

$table = str_replace(" ","",$table);

$table = str_replace(" ","",$table);

$table = explode(",",$table);

array_pop($table);

return $table;

}//將html**的每行每列轉為陣列,採集**資料

function get_td_array($table) ",$table);

$table = str_replace("","",$table);

//去掉 html 標記

$table = preg_replace("'<[\/\!]*?[^<>]*?>'si","",$table);

//去掉空白字元

$table = preg_replace("'([\r\n])[\s]+'","",$table);

$table = str_replace(" ","",$table);

$table = str_replace(" ","",$table);

$table = explode('', $table);

array_pop($table);

foreach ($table as $key=>$tr) ', $tr);

array_pop($td);

$td_array = $td;

}return $td_array;

}//返回字串中的所有單詞 $distinct=true 去除重複

function split_en_str($str,$distinct=true)

sort($match[1]);

return $match[1];

}

php 採集常用函式 PHP 採集程式中常用的函式

獲得當前的指令碼 function get php url if empty server request uri scriptname server request uri nowurl scriptname else scriptname server php self if empty ser...

PHP採集程式中常用的函式

獲得當前的指令碼 function get php url else return nowurl 把全形數字轉為半形數字 function getalabnum fnum fnum if fnum fnum 0 return fnum 去除html標記 function text2html txt ...

PHP採集程式中常用的函式

獲得當前的指令碼 function get php url else return nowurl 把全形數字轉為半形數字 function getalabnum fnum fnum if fnum fnum 0 return fnum 去除html標記 function text2html txt ...