弱柳千条杏一枝,半含春雨半垂丝。风景再美,若没人一起欣赏,也会有种莫名的忧伤。满山满谷乳白色的雾气,那样的深,那样的浓,像流动的浆液,能把人浮起来似的。
DedeCMS5.7百度主动推送PHP代码,如果,你还是不明白,那。。。。只能帮你到这里了…
这是干货,懂点代码的可以自己延伸(保存为任意php文件,放到plus目录下,访问看下结果?)。另外,避免手动提交的麻烦,可以服务器端设置个时间每天自动执行。
<?php
require_once(dirname(__FILE__).'/../include/common.inc.php');
require_once(DEDEINC."/channelunit.class.php");
$whereSql = '';
//设置推送时间 每天有指定配额
$year = date("Y");
$month = date("m");
$day = date("d");
$dayBegin = mktime(0,0,0,$month,$day,$year);//当天开始时间戳
$dayEnd = mktime(23,59,59,$month,$day,$year);//当天结束时间戳
$whereSql = "where arc.pubdate<".$dayEnd." AND arc.pubdate>".$dayBegin;
$query = "SELECT arc.*,tp.* FROM `2ky_archives` arc
LEFT JOIN `2ky_arctype` tp ON arc.typeid=tp.id
$whereSql
ORDER BY arc.id DESC";
//下面网址换成自己的网站
$urls = "";
$dsql->SetQuery($query);
$dsql->Execute();
while($row = $dsql->GetArray())
{
$urls .= "http://www.dede58.com".GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'],
$row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']).",";
}
$urls = substr($urls,0,-1);
$urls = explode(",",$urls);
//api url换成自己的,站长工具里有
$api = 'http://data.zz.baidu.com/urls?site=www.dede58.com&token=uUGps6ZBwuEYk0LW';
$ch = curl_init();
$options = array(
CURLOPT_URL => $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);
echo $result;
?> 到此这篇关于织梦dedeCMS5.7非实时百度主动推送就介绍到这了。当你的才华还撑不起你的野心时,那你就应该静下心来学习。更多相关织梦dedeCMS5.7非实时百度主动推送内容请查看相关栏目,小编编辑不易,再次感谢大家的支持!