php获取bing每日壁纸示例分享

前端技术 2023/09/06 PHP

复制代码 代码如下:

<?php
 $str=file_get_contents(\'http://cn.bing.com/HPImageArchive.aspx?idx=0&n=1\');
 if(preg_match(\"/<url>(.+?)<\\/url>/ies\",$str,$matches)){
  $imgurl=\'http://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.stayed.cn/item/15835

转载请注明出处。

本站部分内容来源于网络,如侵犯到您的权益,请 联系我

我的博客

人生若只如初见,何事秋风悲画扇。