This repository has been archived by the owner on Oct 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
/* | ||
辣鸡 Bing 今日美图 API 测试版 By Little_Qiu | ||
Version: 1.2-test | ||
感谢 @GPlane | ||
这是辣鸡 Bing 今日美图 API 的测试版。 | ||
该版本可能未开发完全的或含有不稳定因素,请谨慎用于生产环境! | ||
*/ | ||
|
||
// 检查 PHP 版本(然而并没有什么卵用) | ||
if (version_compare(PHP_VERSION, '5.2.0', '<')) { | ||
exit('错误:辣鸡 Bing 今日美图 API 要求 PHP 版本不低于 5.2.0,你正在使用的是 '.PHP_VERSION); | ||
} | ||
|
||
// 获取 Bing 今日美图的图片地址 | ||
function bg() { | ||
|
||
// 导入设置 | ||
include 'settings.php'; | ||
|
||
// 检查是否使用固定时间 | ||
if (useurl) { | ||
|
||
// 获取参数 | ||
$daysagoquery = "$_GET[daysago]"; | ||
|
||
// 获取 JSON | ||
$data = json_decode(file_get_contents("http://cn.bing.com/HPImageArchive.aspx?format=js&idx=$daysagoquery&n=1"), true); | ||
|
||
} else { | ||
|
||
// 获取 JSON | ||
$data = json_decode(file_get_contents("http://cn.bing.com/HPImageArchive.aspx?format=js&idx=$daysago&n=1"), true); | ||
|
||
}; | ||
|
||
// 返回 URL | ||
return "https://cn.bing.com".$data['images'][0]['url']; | ||
|
||
}; | ||
|
||
// 302 跳转 | ||
$url = bg(); | ||
header("Location: $url"); | ||
exit; | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
<?php | ||
|
||
// 是否使用固定的时间 | ||
$useurl = false; | ||
|
||
// 设置时间(几天前),将 0 修改为你需要的时间 | ||
$daysago = '0'; | ||
|
||
|