织梦CMS如何自动提交百度快速收录(更新教程)

原创 admin  2022-09-21 14:04  阅读 6 次

因为百度取消了自动推送按钮,现在改成了API快速收录,然后,很多人的织梦CMS网站都是用的以前的形式,自动推送,那么,现在就需要修改成自动提交百度快速收录!

那么,织梦CMS如何自动提交百度快速收录呢,在这里,欢欢老师就给大家分享一下,希望能对大家有所帮助!

织梦CMS网站怎么提交百度快速收录

第一步:在网站\dede目录(网站管理后台)找到文件article_add.php

第二步:找到以下代码:

  1. $artUrl = MakeArt($arcID,true,true,$isremote);
  2.     if($artUrl=='')
  3.     {
  4.         $artUrl = $cfg_phpurl."/view.php?aid=$arcID";
  5.     }

在上面代码的 } 符号下面加入

  1. else{
  2. $urls = array(
  3.     'http://www.suchunyu.com'.$artUrl.'',
  4. );
  5. //上面固定连接改成你的域名
  6. $api = 'http://data.zz.baidu.com/urls?site=https://www.suchunyu.com/&token=7LuOm5QNB5meFxHQ&type=daily';
  7. // 上面api接口调用地址改成你自己
  8. $ch = curl_init();
  9. $options =  array(
  10.     CURLOPT_URL => $api,
  11.     CURLOPT_POST => true,
  12.     CURLOPT_RETURNTRANSFER => true,
  13.     CURLOPT_POSTFIELDS => implode("\n", $urls),
  14.     CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
  15. );
  16. curl_setopt_array($ch, $options);
  17. $result = curl_exec($ch);
  18. //echo不要
  19. }

第三步:找到以下代码

  1. <a href='catalog_do.php?cid=$typeid&dopost=listArchives'><u>已发布文章管理</u></a>

在上面代码的下面加入

  1. <a href=''><u>百度提交返回".$result."</u></a>

然后保存,下面看下提交效果:

出现这个结果,就说明提交成功了!

文章所需要的代码下载在此处:2022072712035974

来源:https://www.huanp.com/seoyouhua/22516.html
声明:欢迎分享本文,转载请保留出处!

发表评论


表情