php开发一套随机调取全网壁纸内容,核心代码如下
<?php
//ini_set("display_errors", "On");
//error_reporting(E_ALL | E_STRICT);
//if(!defined("a")) exit("Error 001");
//获取当前主域名
$domainurl="http://".$_SERVER['SERVER_NAME'];
$listnum = array('①','②','③','④','⑤','⑥','⑦','⑧','⑨','⑩');
$myurl = myurl();
if(isset($_GET['q'])){
$q = hd_clearStr($_GET['q']);
}
if(isset($_GET['p'])){
$p=$_GET['p'];
if($p>50){
$p=50;
}
if(REWRITE==1 && strpos(URLRULE2,'{qe}')>-1 && strpos($myurl,'q=')<1&& strpos($myurl,'more=1')<1){
$q = qdecode($q);
$q = htmlspecialchars($q);
}
}else{
$p=1;
if(REWRITE==1 && strpos(URLRULE1,'{qe}')>-1 && strpos($myurl,'q=')<1&& strpos($myurl,'more=1')<meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><link rel="canonical" href="<?php echo 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];?>"><?php echo $q; if($p!=1){echo '_第'.$p.'页';}?> - <?php echo $huoduan['sitename']?><meta name="keywords" content="下载" /><meta name="description" content="<?php echo $huoduan['sitename']."为您提供".$q."相关壁纸,包括".$q."最新壁纸下载,让你更好更全面的获取".$q."精美壁纸!";?>" /><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><meta name="robots" content="index,follow"/><meta name="referrer" content="no-referrer" /><link rel="stylesheet" href="css/wallpaper.css"><link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">壁纸网<a class="nav-link" href="javascript:void(0)"
onclick="loadData('360new', true);changeTitle(this)">最新壁纸
分类壁纸 <a class="nav-link" href="javascript:void(0)"
onclick="loadData('bing', true);changeTitle(this)">必应美图<a class="nav-link" href="javascript:void(0)" onclick="loadData('ciba', true);changeTitle(this);"
title="金山词霸每日一句壁纸">每日英语<?php
$huoduan['hotkeytype']==1;
$filename=randtxt();
$diykey = file_get_contents(ROOT_PATH.'/data/sitemap/'.$filename);
if(strpos($diykey,"\r\n")>-1){
$diylist = explode("\r\n",$diykey);
}else{
$diylist = explode("\n",$diykey);
}
shuffle($diylist);
if(is_array($diylist)){
$count = count($diylist);
if($count>10){
$j = 3;
}else{
$j = $count;
}
for($i=0;$i<$j;$i++){
echo '';
echo ''.huoduansourl($diylist[$i]).'" _href="'.huoduansourl($diylist[$i]).'">'.$diylist[$i].'';
echo "";
}
}
?>壁纸大全 cript:void(0);" class="uptoTop" _href="javascript:void(0);">壁纸加载中……横屏显示<script src="https://cdn.bootcss.com/jquery/1.11.3/jquery.min.js">cript><script type="text/javascript" src="js/jquery.lazyload.min.js">cript><script type="text/javascript" src="js/jquery.onepage-scroll.min.js">cript><script type="text/javascript" src="js/wallpaper.js">cript><script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js">cript>api接口代码:
<?php
$cid = getParam('cid', '360new');
switch($cid)
{
case '360new': // 360壁纸 新图片
$start = getParam('start', 0);
$count = getParam('count', 10);
echojson (file_get_contents("http://wp.birdpaper.com.cn/intf/newestList?pageno={$start}&count={$count}"));
break;
case '360tags':
echojson (file_get_contents("http://wp.birdpaper.com.cn/intf/getCategory"));
break;
case 'bing':
$start = getParam('start', -1);
$count = getParam('count', 8);
echojson (file_get_contents("http://cn.bing.com/HPImageArchive.aspx?format=js&idx={$start}&n={$count}"));
break;
case '360search':
$content = getParam('content', '');
$start = getParam('start', 0);
$count = getParam('count', 10);
echojson (file_get_contents("http://wp.birdpaper.com.cn/intf/search?content={$content}&pageno={$start}&count={$count}"));
break;
default:
$start = getParam('start', 0);
$count = getParam('count', 10);
echojson (file_get_contents("http://wp.birdpaper.com.cn/intf/GetListByCategory?cids={$cid}&pageno={$start}&count={$count}"));
}
function getParam($key,$default='')
{
return trim($key && is_string($key) ? (isset($_POST[$key]) ? $_POST[$key] : (isset($_GET[$key]) ? $_GET[$key] : $default)) : $default);
}
function echojson($data) //json和jsonp通用
{
// $callback = getParam('callback');
// if($callback != "") //输出jsonp格式
// {
// echo $callback."(".$data.")";
// }
// else
// {
echo $data;
// }
}


