演示图(每天都不一样)
你如果不信,你明天也过来看下方这个图 每天都是不一样的!
<?php
/**
*Bing图片获取
*/
$str = file_get_contents('https://cn.bing.com/HPImageArchive.aspx?format=idx=0&n=1');
if(preg_match("/<url>(.+?)<\/url>/",$str,$matches)){
$imgurl='http://cn.bing.com'.$matches[1];
}else{
$imgurl='https://xiaoerhucom.oss-cn-hangzhou.aliyuncs.com/bg/bg_page_reg.png';
}
header("Location: $imgurl");
?>
使用方法
将上面的代码,保存到 index.php 文件
上传支持PHP文件解析的空间或者服务器
直接访问:http://域名/index.php 就可以看到图片的链接啦
本站背景页面就是调用的此API