Home > Backend Development > PHP Tutorial > php获取bing每天图片

php获取bing每天图片

WBOY
Release: 2016-06-13 11:53:45
Original
1018 people have browsed it

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


必应效果  必应地址:http://cn.bing.com/


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



代码: 复制为.php文件

<br /><?php<br />	$str=file_get_contents('http://cn.bing.com/HPImageArchive.aspx?idx=0&n=1');<br />	if(preg_match("/<url>(.+?)<\/url>/ies",$str,$matches)){<br />		$imgurl='http://cn.bing.com'.$matches[1];<br />	}<br />	if($imgurl){<br />		header('Content-Type: image/JPEG');<br />		@ob_end_clean();<br />		@readfile($imgurl);<br />		@flush(); @ob_flush();<br />		exit();<br />	}else{<br />		exit('error');<br />	}<br />?><br />
Copy after login

------解决方案--------------------
感谢分享 mark一下
------解决方案--------------------
非常不错。呵呵,
------解决方案--------------------
非常不错。赞。
------解决方案--------------------
不错 有意思

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template