php获取bing每日壁纸示例分享
php获取bing每日壁纸示例分享
发布时间:2016-12-29 来源:查字典编辑
摘要:复制代码代码如下:

复制代码 代码如下:

<?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');

}

?>

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新php教程学习
热门php教程学习
编程开发子分类