设置背景可以用我这个链接:https://www.mcheng.cn/bing.php
想放在自己的vps上,只需要复制下面代码保存为php文件即可。
<?php
// 创建一个新cURL资源
$url = 'https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-US';
$ch = curl_init();
$timeout = 5;
// 设置URL和相应的选项
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
// 抓取URL
$lines_string = curl_exec($ch);
// 关闭cURL资源,并且释放系统资源
curl_close($ch);
//输出内容,大家也可以保存在自己的服务器上
#echo $lines_string;
$matches=json_decode($lines_string);
#echo $matches->images[0]->url;
$imgurl='https://cn.bing.com'.$matches->images[0]->url;;
header("Location: $imgurl"); //header跳转