获取bing必应图片

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<?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];    	 						
} 
?>
<style type="text/css">
body {background-image: url("<?php echo $imgurl; ?>");}
</style>
</head>

<body>
</body>
</html>
posted @ 2019-12-29 20:42  绿林豪士  阅读(212)  评论(0编辑  收藏  举报