基于Discuz在線分詞的Dedecms文章關鍵詞批量優(yōu)化
  • 更新時間:2024-10-28 22:30:58
  • 網站建設
  • 發(fā)布時間:1年前
  • 377

基于discuz在線分詞批量優(yōu)化Dedecms文章關鍵詞

dedecms自帶標簽(關鍵詞)提取功能(北京網站制作),但分詞總是不夠精確。當然,對于一天更新十篇以上,SEO精準執(zhí)行的用戶,手動輸入可以更好的控制(高端網站建設)。但對于題材廣泛、內容更新量大的用戶來說,dede拆分并不完美。

discuz在線分詞是一個在線免費的分詞提示界面。中文論壇和suspite用戶有幾十萬,上下文和單元格詞庫的完善有更多的數據。本小程序基于discuz在線分詞,批量更新發(fā)布內容的關鍵詞(標簽)。如果數據量大(5萬以上)或者虛擬主機用戶,最好使用本地環(huán)境。會快一點。

l; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; ">  使用方法,cms安裝目錄,新建c.php,拷入以下內容,自己對應編碼用notepad設置相應gbk或utf8。運行 yourwebsite/c.php?id=1

<?php
require_once(dirname(__FILE__).”/include/common.inc.php”);

$id = isset($id) && is_numeric($id) ? $id : 0;

for ($a=$id; $a<$id+10; $a++){

?$row = $dsql->GetOne(” SELECT arc.title,tp.body FROM `@__archives` arc LEFT JOIN `@__addonarticle` tp ON arc.id=tp.aid where arc.id=’$a’ “);
?if(is_array($row))
?{
??$title = $row['title'];
??$body = $row['body'];
??$keywords=zhgetkey($title.$body);
??$dsql->ExecuteNoneQuery(” Update `@__archives` set keywords=’$keywords’ where id=’$a’ “);
??echo $a.’:’.$keywords.’<br />’;
?}
}
?
?if ($a>80000){break;}

echo “<script>”;
echo “setTimeout(”location.replace(‘c.php?id=$a’)”,0)”;
echo “</script>”;

function zhgetkey($contents){
$rows = strip_tags($contents);
$arr = array(‘ ‘,’ ‘,”s”, “rn”, “n”, “r”, “t”, “>”, ““”, “””,”<br />”);
$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=$qc_rows&ics=gbk&ocs=gbk”));
preg_match_all(“/<kw>(.*)A[(.*)]](.*)></kw>/”,$data, $out, PREG_SET_ORDER);
$key=”";
for($i=0;$i<5;$i++){
$key=$key.$out[$i][2];
if($out[$i][2])$key=$key.”,”;
}
return $key;
}

function cutstr_html($string, $sublen)???

?{

? $string = strip_tags($string);

? $string = preg_replace (‘/n/is’, ”, $string);

? $string = preg_replace (‘/ | /is’, ”, $string);

? $string = preg_replace (‘/&nbsp;/is’, ”, $string);

??? preg_match_all(“/[x01-x7f]|[xc2-xdf][x80-xbf]|xe0[xa0-xbf][x80-xbf]|[xe1-xef][x80-xbf][x80-xbf]|xf0[x90-xbf][x80-xbf][x80-xbf]|[xf1-xf7][x80-xbf][x80-xbf][x80-xbf]/”, $string, $t_string);??

? if(count($t_string[0]) – 0 > $sublen) $string = join(”, array_slice($t_string[0], 0, $sublen)).”…”;??

? else $string = join(”, array_slice($t_string[0], 0, $sublen));

??? return $string;

?}

?>

我們專注高端建站,小程序開發(fā)、軟件系統(tǒng)定制開發(fā)、BUG修復、物聯(lián)網開發(fā)、各類API接口對接開發(fā)等。十余年開發(fā)經驗,每一個項目承諾做到滿意為止,多一次對比,一定讓您多一份收獲!

本文章出于推來客官網,轉載請表明原文地址:https://www.tlkjt.com/web/13660.html

在線客服

掃碼聯(lián)系客服

3985758

回到頂部