最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

php 自寫函數(shù)代碼 獲取關(guān)鍵字 去超鏈接

 更新時(shí)間:2010年02月08日 10:00:49   作者:  
根據(jù)權(quán)重獲取關(guān)鍵字 去掉文章中的超鏈接簡單,簡潔
1.根據(jù)權(quán)重獲取關(guān)鍵字

復(fù)制代碼 代碼如下:

function getkey($contents){
$rows = strip_tags($contents);
$arr = array(' ',' ',"\s", "\r\n", "\n", "\r", "\t", ">", "“", "”");
$qc_rows = str_replace($arr, '', $rows);
if(strlen($qc_rows)>2400){
$qc_rows = substr($qc_rows, '0', '2400');
}
$data = @implode('', file("http://keyword.discuz.com/related_kw.html?title=$contents&ics=gbk&ocs=gbk"));
preg_match_all("/<kw>(.*)A\[(.*)\]\](.*)><\/kw>/",$data, $out, PREG_SET_ORDER);
for($i=0;$i<5;$i++){
$key=$key.$out[$i][2];
if($out[$i][2])$key=$key.",";
}
return $key;
}
//$contents為你要得到關(guān)鍵字的文章


2.去掉文章中的超鏈接簡單,簡潔

復(fù)制代碼 代碼如下:

function get_new_content($content){
include("../simple_html_dom.php");
$html = str_get_html($content);
$a_href = $html->find('a');
foreach($a_href as $link){
$text = $link->plaintext;//鏈接中的文字;
$link->outertext = $text;
}
$now_content = $html->save();
}
//preg_replace("/<a .*?>(.*?)<\/a>/i","\${1}", $content); 這樣用正則也可以

相關(guān)文章

最新評(píng)論

安宁市| 通山县| 镇宁| 商河县| 屏南县| 扶余县| 伊吾县| 宁津县| 苏州市| 增城市| 定安县| 会泽县| 巴林左旗| 剑河县| 天台县| 淅川县| 辽源市| 瑞安市| 四平市| 昌平区| 布尔津县| 博客| 平定县| 清水河县| 定州市| 平邑县| 沂源县| 徐水县| 夏邑县| 丰台区| 濮阳县| 依安县| 新津县| 渭南市| 易门县| 大连市| 晋江市| 增城市| 乡城县| 凤翔县| 平湖市|