织梦采集没有自动生成摘要和关键字怎么办
来源:小码王信奥 时间:2024-10-16 浏览量:49

织梦采集没有自动生成摘要和关键字怎么办?

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

推荐学习:织梦cms

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

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

下面是我的解决办法:

1、修改 include/dedecollection.class.php

//自动分析关键字和摘要  
preg_match("/<meta[\s]+name=[&#39;\"]keywords[&#39;\"] content=[&#39;\"](.*)[&#39;\"]/isU",$this->tmpHtml,$inarr);  
preg_match("/<meta[\s]+content=[&#39;\"](.*)[&#39;\"] name=[&#39;\"]keywords[&#39;\"]/isU",$this->tmpHtml,$inarr2);  
if(!isset($inarr[1]) && isset($inarr2[1]))  
{  
$inarr[1] = $inarr2[1];  
}

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

//自动分析关键字和摘要  
preg_match("/<meta[\s]+name=[&#39;\"]keywords[&#39;\"] content=[&#39;\"](.*)[&#39;\"]/isU",$this->tmpHtml,$inarr);  
preg_match("/<meta[\s]+content=[&#39;\"](.*)[&#39;\"] name=[&#39;\"]keywords[&#39;\"]/isU",$this->tmpHtml,$inarr2);  
preg_match("/<meta[\s]+name=keywords content=[&#39;\"](.*)[&#39;\"]/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=[&#39;\"]description[&#39;\"] content=[&#39;\"](.*)[&#39;\"]/isU",$this->tmpHtml,$inarr);  
preg_match("/<meta[\s]+content=[&#39;\"](.*)[&#39;\"] name=[&#39;\"]description[&#39;\"]/isU",$this->tmpHtml,$inarr2);  
if(!isset($inarr[1]) && isset($inarr2[1]))  
{  
$inarr[1] = $inarr2[1];  
}

用下面的代码替换掉上面的:

preg_match("/<meta[\s]+name=[&#39;\"]description[&#39;\"] content=[&#39;\"](.*)[&#39;\"]/isU",$this->tmpHtml,$inarr);  
preg_match("/<meta[\s]+content=[&#39;\"](.*)[&#39;\"] name=[&#39;\"]description[&#39;\"]/isU",$this->tmpHtml,$inarr2);  
preg_match("/<meta[\s]+name=description content=[&#39;\"](.*)[&#39;\"]/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];  
}

以上就是织梦采集没有自动生成摘要和关键字怎么办的详细内容,更多请关注本网内其它相关文章!

免责申明:以上展示内容来源于合作媒体、企业机构、网友提供或网络收集整理,版权争议与本站无关,文章涉及见解与观点不代表小码王官方立场,请读者仅做参考。本文标题:织梦采集没有自动生成摘要和关键字怎么办,本文链接:http://www.xiaomawang.vip/help/10625.html;欢迎转载,转载请说明出处。若您认为本文侵犯了您的版权信息,或您发现该内容有任何涉及有违公德、触犯法律等违法信息,请您立即通过邮件(邮箱号: hzlixy@xiaoma.cn)联系我们及时修正或删除。