婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁(yè) > 網(wǎng)站建設(shè) > 建站知識(shí) > DEDE采集時(shí)自動(dòng)生成摘要和關(guān)鍵字

DEDE采集時(shí)自動(dòng)生成摘要和關(guān)鍵字

POST TIME:2020-03-28 23:54

最近在學(xué)習(xí)織夢(mèng)CMS的采集功能,在采集的過(guò)程我總是發(fā)現(xiàn)織夢(mèng)5.6可以采集到內(nèi)容,但不可自動(dòng)生成摘要和關(guān)鍵字,關(guān)鍵字和摘要都是空的。感覺很遺憾,怎么辦呢?

可能很多人都遇到了和我一樣的問(wèn)題,在論壇實(shí)在沒(méi)找到好的解決辦法,就自己動(dòng)手去改改文件。廢話不多說(shuō)了。

下面是我的解決辦法

比如我采集了網(wǎng)站:http://www.genban.org

首頁(yè)的meta代碼是:

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>一條龍建站 - 建站服務(wù),建站教程,新云建站教程,織夢(mèng)建站教程,CMS建站教程</title>
<meta name="description" content="一個(gè)綜合建站教程、建站經(jīng)驗(yàn)交流、織夢(mèng)CMS建站技巧、CMS建站模板的站長(zhǎng)教程網(wǎng)。" />
<meta name="keywords" content="建站教程,織夢(mèng)建站教程,CMS建站教程" />

如果用織夢(mèng)模板的采集的時(shí)候就沒(méi)有辦法自動(dòng)獲取description和keywords的值的。

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

用下面的代碼替換掉上面的:

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

重新上傳,大功告成。記得覆蓋的時(shí)候一定要備份哦。



收縮
  • 微信客服
  • 微信二維碼
  • 電話咨詢

  • 400-1100-266
主站蜘蛛池模板: 清丰县| 靖宇县| 武山县| 阳西县| 洪洞县| 太仓市| 阿城市| 长垣县| 屏边| 洪江市| 东辽县| 武胜县| 汤阴县| 五峰| 兰考县| 碌曲县| 象山县| 客服| 定陶县| 泰宁县| 互助| 泾川县| 宁陕县| 托克托县| 旬邑县| 廊坊市| 繁峙县| 禹城市| 理塘县| 文成县| 茌平县| 云和县| 郴州市| 台北市| 沅陵县| 顺昌县| 姚安县| 宁德市| 贵定县| 大冶市| 四会市|