诸城SEO(织梦后台文档百度主动推送方法)
诸城SEO:织梦后台文档百度主动推送(实时)方法。

1.织梦网站后台-系统-基本参数,添加新变量,如果变量值未填写或者为空将不推送
自定义变量cfg_baidu_push,参数说明:百度推送接口
2.打开 /dede(后台目录)/inc/inc_archives_functions.php 在文件最末尾插入
/**
* 百度主动推送
*/
function baidu_push($id="",$qstr="")
{
global $cfg_multi_site,$cfg_basehost,$cfg_baidu_push;
if(!empty($id) && !empty($cfg_baidu_push))
{
if( !empty($id) && empty($qstr) ) $qstr = $id;
if($qstr=='')
{
exit();
}
$qstrs = explode('`',$qstr);
$cfg_domain = $cfg_multi_site == 'N' ? $cfg_basehost : '';
$urls = array();
$i = 0;
foreach($qstrs as $aid)
{
$i++;
$arcrow = GetOneArchive($aid);
$url = $cfg_domain.$arcrow['arcurl'];
$urls[] = $url;
$artlist .= $url."
";
}
if($i>1) $artlist = "";
if(!empty($urls)){
$ch = curl_init();
$options = array(
CURLOPT_URL => trim($cfg_baidu_push),
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);
curl_close($ch);
$result = json_decode($result, true);
if(isset($result['success'])){
$not_same_site = isset($result['not_same_site'][0]) ? " 推送链接与百度绑定站点不一致 " : "";
$not_valid = isset($result['not_valid'][0]) ? " 推送链接不合法 " : "";
return $not_same_site . $not_valid . '百度主动推送成功 '.$result['success'].' 条!当天剩余 '.$result['remain'].' 条可推送!'.$artlist;
}else{
return '百度主动推送失败,错误码:'.$result['error'].'详情';
}
}
return "没有数据被推送!";
}
}
3.找到后台文档发布程序PHP文件
如文章模型的是
/dede/article_add.php
根据你的需要在对应的php文件中找到
//返回成功信息
在上面添加
if(!empty($cfg_baidu_push))
{
$backurl .= “<p> ”.baidu_push($arcID).“</p>”;
}
继续找到
line-height:36px;height:36px
该为
line-height:36px;
随机文章
SEO小小课堂网SEO教程
站长导航
友情链接交换
搜素引擎算法
关键词排名优化
GEO培训
SEO小小课堂网
百度搜索“网赚联盟”即可找到本站,微信搜索“小小课堂网”关注小小课堂网公众号。网赚联盟( wangzhuan.org.cn )欢迎用户投稿,发布者:用户投稿,文章版权归作者所有,投稿文章不代表网赚联盟立场,中二少年发布为网赚联盟原创文章,转载请注明出处:https://wangzhuan.org.cn/17166.html

微信扫一扫
支付宝扫一扫