織夢(mèng)DEDECMS采集沒(méi)有手動(dòng)生成摘要和關(guān)鍵字的解決教程
優(yōu)采云 發(fā)布時(shí)間: 2020-04-18 09:49
織夢(mèng)5.6采集到了內容,可沒(méi)有手動(dòng)生成摘要和關(guān)鍵字dedecms采集的文章怎么沒(méi)有關(guān)鍵字和描述dedecms采集的文章怎么沒(méi)有關(guān)鍵字和描述,關(guān)鍵字和摘要都是空的。
可能很多人都碰到了和我一樣的問(wèn)題,在峰會(huì )實(shí)在沒(méi)找到好的解決辦法,就自己動(dòng)手去改改文件。廢話(huà)不多說(shuō)了。
下面是我的解決辦法:
1、修改 include/dedecollection.class.php
//自動(dòng)剖析關(guān)鍵字和摘要
preg_match("/<meta[s]+name=['"]keywords['"] content=['"](.*)['"]/isU",$this->tmpHtml,$inarr); preg_match("/<meta[s]+content=['"](.*)['"] name=['"]keywords['"]/isU",$this->tmpHtml,$inarr2); if(!isset($inarr[1]) && isset($inarr2[1])) { $inarr[1] = $inarr2[1]; }
用下邊一段代碼替換里面的
//自動(dòng)分析關(guān)鍵字和摘要 preg_match("/<meta[s]+name=['"]keywords['"] content=['"](.*)['"]/isU",$this->tmpHtml,$inarr); preg_match("/<meta[s]+content=['"](.*)['"] name=['"]keywords['"]/isU",$this->tmpHtml,$inarr2); preg_match("/<meta[s]+name=keywords content=['"](.*)['"]/isU",$this->tmpHtml,$inarr3); if(!isset($inarr[1]) && isset($inarr2[1])) { $inarr[1] = $inarr2[1]; } if(!isset($inarr[1]) && isset($inarr3[1])) { $inarr[1] = $inarr3[1]; }
改了里面的, 還有另一個(gè)地方須要更改的
preg_match("/<meta[s]+name=['"]description['"] content=['"](.*)['"]/isU",$this->tmpHtml,$inarr); preg_match("/<meta[s]+content=['"](.*)['"] name=['"]description['"]/isU",$this->tmpHtml,$inarr2); if(!isset($inarr[1]) && isset($inarr2[1])) { $inarr[1] = $inarr2[1]; }