A5下载 - 努力做内容最丰富最安全的下载站!

A5站长下载站

当前位置:A5下载 > 源码技巧 > 父类数据 > php获取bing每日壁纸示例分享

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

时间:2014-02-25 11:46作者:网络人气:187

必应每天都会更新一些漂亮高清的图片,这段代码获取必应每天更新的图片。我们也可以把它作为网站的背景使用。

代码如下:

<?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://down.admin5.com/php/

标签php,获取,bing,每日,壁纸,示例,分享,这篇,文章

相关下载

查看所有评论+

网友评论

网友
您的评论需要经过审核才能显示

公众号