mirror of
https://github.com/zhxycn/BingWallpaperAPI.git
synced 2024-11-22 00:45:35 +00:00
Initial commit
This commit is contained in:
commit
f837cd66e5
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 zhxy-CN
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
16
index.php
Normal file
16
index.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
function a() {
|
||||
$ago = '0'; // 设定图片的时间(几天前。0为今天,1为昨天,2为前天,-1为明天,以此类推,由于调用的是必应国内版,当日16至次日16时为一张壁纸。)
|
||||
$data = json_decode(file_get_contents('https://cn.bing.com/HPImageArchive.aspx?format=js&idx='.$ago.'&n=1&mkt=zh-CN'), true);
|
||||
return "https://cn.bing.com".$data['images'][0]['url'];
|
||||
};
|
||||
$url = a();
|
||||
|
||||
if ($_GET['encode'] == 'json') {
|
||||
$echo = array('url' => $url);
|
||||
echo json_encode($echo);
|
||||
} else {
|
||||
header("Location:$url");
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user