必应每天都会更新一些漂亮高清的图片,这段代码获取必应每天更新的图片。我们也可以把它作为网站的背景使用。
代码如下:
<?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');
 }
?>
 必应效果  必应地址:http://cn.bing.com/

 实际使用后效果  演示地址:http://cs.dzzoffice.com/

常用php源码下载:http://www.xia-zai.com/php/