<meta name=description content=... />

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

preg_match("/<meta[\s]+name=['\"]keywords['\"] content=['\"](.*)['\"]/isU",$this->tmpHtml,$inarr); 

织梦DedeCMS网站采集没有自动生成摘要和关键词的解决办法: 

比如我采集了网站:

$inarr[1] = $inarr2[1]; 

preg_match("/<meta[\s]+content=['\"](.*)['\"] name=['\"]keywords['\"]/isU",$this->tmpHtml,$inarr2); 

//自动分析关键字和摘要

}

if(!isset($inarr[1]) && isset($inarr3[1])) 

preg_match("/<meta[\s]+content=['\"](.*)['\"] name=['\"]keywords['\"]/isU",$this->tmpHtml,$inarr2); 

preg_match("/<meta[\s]+content=['\"](.*)['\"] name=['\"]description['\"]/isU",$this->tmpHtml,$inarr2); 

$inarr[1] = $inarr2[1]; 

preg_match("/<meta[\s]+name=['\"]description['\"] content=['\"](.*)['\"]/isU",$this->tmpHtml,$inarr); 

下面是我的解决办法:

这个可能是dedecms中自动分析关键字和摘要的一个bug吧,没有考虑到<meta name=keywords content ='' />这种情况!

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

preg_match("/<meta[\s]+content=['\"](.*)['\"] name=['\"]description['\"]/isU",$this->tmpHtml,$inarr2); 

}

if(!isset($inarr[1]) && isset($inarr2[1])) 

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

preg_match("/<meta[\s]+name=keywords content=['\"](.*)['\"]/isU",$this->tmpHtml,$inarr3); 

preg_match("/<meta[\s]+name=description content=['\"](.*)['\"]/isU",$this->tmpHtml,$inarr3);  

<title>织梦模板_dede模板|织梦模板下载|织梦企业模板 -专注织梦模板设计制作</title>

if(!isset($inarr[1]) && isset($inarr2[1])) 

preg_match("/<meta[\s]+name=['\"]description['\"] content=['\"](.*)['\"]/isU",$this->tmpHtml,$inarr); 

<meta name="keywords" content="专注织梦模板设计制作!提供精品织梦DedeCMS模板下载,百度,分享各种素材资源,360好搜,技术教程等信息。" />

大家注意到了这段代码和其它网站的区别了没??

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

首页的meta代码是:

preg_match("/<meta[\s]+name=['\"]keywords['\"] content=['\"](.*)['\"]/isU",$this->tmpHtml,$inarr); 

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

$inarr[1] = $inarr2[1]; 

1、修改 include/dedecollection.class.php 内容来源:

if(!isset($inarr[1]) && isset($inarr3[1]))

}

}

//自动分析关键字和摘要

如果用dedecms的采集的时候就没有办法自动获取description和keywords的值的。 

{

$inarr[1] = $inarr2[1]; 

if(!isset($inarr[1]) && isset($inarr2[1])) 

<meta name="description" content="dede模板,织梦模板,织梦模板下载,dedecms,织梦企业模板" />

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

采集的选项里面也没有自己填写关键字和摘要的选项。那我只能自己动手修改文件了。

$inarr[1] = $inarr3[1];  

$inarr[1] = $inarr3[1];

if(!isset($inarr[1]) && isset($inarr2[1])) 

<meta name=keywords content=... />

就是name="description" 和 name="keywords" 少了双引号""

360好搜