有时候我们推送页面URL并不是zblog系统产生的页面甚至当你想要推送其他网站URL的时候可能就需要到另外写脚本或插件。
那么在这里给大家送上一个简单的推送脚本,配合zblog百度推送懒人版适用于推送任何网站内容。
首先我们在zblog网站根目录新建一个tuisong.php,
<?php require 'zb_system/function/c_system_base.php'; $page = GetVars('page', 'GET'); $data = get_data(array("act" => "temp","page" => $page));//获取内容数据 $s = json_decode($data, true); $pageall = $s['pageAll']; $next = $page + 1; $progress = (int) ($page / $pageall); $time = 3;//定时跳转时间 $urls = array(); foreach($s['list'] as $k=>$a){ $urls[] = "https://www.newbii.cn/zblogphp/download/{$a['ID']}.html"; } /* 百度推送懒人版插件推送脚本 Bdpush_lazy_ajax($urls, $api) $urls URL数组 $api 百度推送api,留空默认插件配置 */ $status = Bdpush_lazy_ajax($urls); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>推送URL脚本</title> <link href="https://s3.pstatp.com/cdn/expire-1-M/twitter-bootstrap/3.3.5/css/bootstrap.min.css" type="text/css" rel="stylesheet" /> </head> <body style="background: #fafafa;"> <?php if($next > $pageall) { ?> <div style="color:red; text-align:center">工作完毕!</div> <?php exit();}?> <div class="alert alert-warning" role="alert">(<?php echo $page."/".$pageall;?>)请不要关闭页面,<span id="endtime"><?php echo $time;?></span>秒后跳到下一页!</div> <div class="progress"> <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="1" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $progress;?>%;"> <span><?php echo $progress;?>%</span> </div> </div> <table class="table table-hover"> <thead> <tr><th colspan="2">推送状态:<?php echo $status;?></th></tr> <tr> <th>ID</th> <th>推送列表</th> </tr> </thead> <tbody> <?php foreach($urls as $k=>$a) { echo "<tr><td><span class='num'>{$k}</span></td><td><a target='_blank' href='{$a}'>{$a}</a></td></tr>"; }?> </tbody> </table> <script language="javascript" type="text/javascript"> <!-- //document.getElementById("loading").style.display="none"; var p = "<?php echo $next;?>"; var second=<?php echo $time;?>; var timer; function change() { second--; if(second>-1) { document.getElementById("endtime").innerHTML=second; timer = setTimeout('change()',1000); } else { clearTimeout(timer); } } timer = setTimeout('change()',1000); setTimeout('ourl()',1000*second); function ourl() { location.href='?page='+p; } --> </script> </body> </html>
以上内容数据请根据自身需求改写
PS,此脚本需配合zblog百度推送懒人版使用
发表评论