接口简介:
Bing每日一图每天会自动更新接口,一天更新一张,浏览lanyou的新模版 MATA 无意中发现了每日获取Bing接口源码,分享给需要做网站背景的来使用。
网站背景代码大部分都会,下面是代码,自行新建一个php文件把代码放进去即可完成接口源码。
列如演示接口:https://api.tx7.co/by.php
接口代码:
<?php /** *Bing图片获取 */ $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]; }else{ $imgurl='/content/templates/dudu/img/a.jpg'; } header("Location: $imgurl"); ?>