欢迎光临 - 我的站长站,本站所有资源仅供学习与参考,禁止用于商业用途或从事违法行为!

织梦cms教程

织梦DEDECMS采集没有自动生成摘要和关键字的解决办法

织梦cms教程 我的站长站 2020-10-02 共117人阅读

织梦5.6采集到了内容,可没有自动生成摘要和关键字,关键字和摘要都是空的。

可能很多人都遇到了和我一样的问题,在论坛实在没找到好的解决办法,就自己动手去改改文件。废话不多说了。

下面是我的解决办法:

1、修改 include/dedecollection.class.php

//自动分析关键字和摘要  
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];  
}

用下面一段代码替换上面的

//自动分析关键字和摘要  
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];  
}

改了上面的, 还有另一个地方需要修改的

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];  
} 
用下面的代码替换掉上面的:
preg_match("/<meta[s]+name=['"]description['"] content=['"](.*)['"]/isU",$this->tmpHtml,$inarr);  
preg_match("/<meta[s]+content=['"](.*)['"] name=['"]description['"]/isU",$this->tmpHtml,$inarr2);  
preg_match("/<meta[s]+name=description 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];  
}


相关专题
采集
采集
2022-03-03 1273

数据采集是网站运营与内容整理的常用技能,合理合规的采集方式能大幅提升内容整理效率。我的站长站整理各类实用采集工具、主流采集软件资源、零基础采集实操教程,讲...

标签 采集教程