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]; }