首頁  >  文章  >  後端開發  >  php获取bing每日壁纸示例分享_PHP教程

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

WBOY
WBOY原創
2016-07-13 10:36:531231瀏覽

复制代码 代码如下:

 $str=file_get_contents('http://cn.bing.com/HPImageArchive.aspx?idx=0&n=1');
 if(preg_match("/(.+?)/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');
 }
?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/736855.htmlTechArticle复制代码 代码如下: ?php $str=file_get_contents('http://cn.bing.com/HPImageArchive.aspx?idx=0 if(preg_match("/url(.+?)\/url/ies",$str,$matches)){ $imgurl='http://cn.bing.com...
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn