PHP 採集程式中常用的函式

2022-09-28 05:24:09 字數 2343 閱讀 2369

複製** **如下:

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

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(」 「,www.cppcns.com」」,$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 採集程式中常用的函式

本文位址: /wangluo/php/53611.html

點讚打賞

分享如果認為本文對您有所幫助請贊助本站

宣告:凡註明"本站原創"的所有文字等資料,版權均屬程式設計客棧所有,歡迎**,但務請註明出處。

標籤:php  採集程式

乙個比較簡單的php 分頁分組類php 建構函式construct的前下劃線是雙的_

您可能感興趣的文章:

廣告贊助

廣告贊助

最新發布

全站最新

廣而告之

© 2018-2021 程式設計客棧 贛icp備17006162號-9

贛公網安備 36110202000251號

top

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 ...