简介
Bing每日图接口php源码,新建文件bing.php上传到网站根目录访问即可。
![图片[1]-bing每日壁纸api-小白资源博客-个人技术分享](https://img.yxyp.cc/2022/11/20221111015347660.png!/format/webp/lossless/true)
代码
<?php
$str=file_get_contents('https://cn.bing.com/HPImageArchive.aspx?idx=0&n=1');
if(preg_match("/<url>(.+?)<\/url>/",$str,$matches)){
$imgurl='https://cn.bing.com'.$matches[1];
}
if($imgurl){
header('Content-Type: image/JPEG');
@ob_end_clean();
@readfile($imgurl);
@flush(); @ob_flush();
exit();
}else{
exit('error');
}
?>

小白资源博客-个人技术分享,原文地址: https://www.yxyp.cc/300
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容