如果你想了解更多關(guān)于帝國(guó)cms的知識(shí),可以點(diǎn)擊:帝國(guó)cms教程
帝國(guó)cms 實(shí)現(xiàn)百度主動(dòng)推送 (非插件)方法。
修改3個(gè)文件找出來(lái)ecmsinfo.php、listinfo.php、userfun.php
1,e/admin/ecmsinfo.php
在任意一個(gè)elseif{….}后添加
elseif($enews=="Post_Baidu_sitemap")//文章實(shí)時(shí)發(fā)送百度 { ????$id=$_POST['id']; ????$urls=$_POST['titleurl']; ????ePostBaiduSitemap($id,$urls); }
2,e/data/html/list/listinfo.php
在
<input>"=$checked?>> <input>">
后面添加
<input>]"?type="hidden"?value='=$titleurl?>'>
在最后一個(gè)標(biāo)簽前添加
??<tr>? ??????<td> ?<input><font><p>備注:多選框藍(lán)色為未審核信息;發(fā)布者紅色為會(huì)員投稿;信息ID粗體為未生成,點(diǎn)擊ID可刷新頁(yè)面.</p></font> </td> ????</tr>
3,e/class/userfun.php添加
//發(fā)送給百度時(shí)時(shí)更新------------------------------- function?ePostBaiduSitemap($id,$_urls){ ????$site?=?'www.xxxxx.com';//你的網(wǎng)站域名 ????$token?=?'xxxxxxx';//百度給的token ????$count?=?count($id);? ????if?(empty($count)) ????{ ????????printerror("未選擇信息ID",?"",?1,?0,?1); ????} ????$urls=array(); ????for($i=0;$i?$api, ????????CURLOPT_POST?=>?true, ????????CURLOPT_RETURNTRANSFER?=>?true, ????????CURLOPT_POSTFIELDS?=>?implode("n",?$urls), ????????CURLOPT_HTTPHEADER?=>?array('Content-Type:?text/plain'), ????); ????curl_setopt_array($ch,?$options); ????$result?=?curl_exec($ch); ????$httpstat?=?curl_getinfo($ch,CURLINFO_HTTP_CODE);? ????curl_close($ch); ????if($httpstat==200){ ????????$obj?=?json_decode($result); ????????printerror("今天剩余{$obj->remain}條,成功提交{$obj->success}條",?"",?1,?0,?1); ????}else{ ????????printerror('推送失敗',?"",?1,?0,?1); ????} }
使用:
網(wǎng)站后臺(tái)——信息
點(diǎn)擊任意左側(cè)樹(shù)形列表
在右側(cè)的信息管理勾選要提交給百度的文章
然后點(diǎn)擊列表下面的批量提交百度!
? 版權(quán)聲明
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載。
THE END
喜歡就支持一下吧
相關(guān)推薦