Skip to content
This repository has been archived by the owner on Oct 12, 2024. It is now read-only.

Commit

Permalink
发布 1.1
Browse files Browse the repository at this point in the history
可以获取过去的图片了。
  • Loading branch information
tnqzh123 committed Jun 5, 2017
1 parent 4aaf7a7 commit 3581c18
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ Bing 今日美图是 Microsoft 公司推出的图片服务,每天更新一张

1. 检查你的主机是否符合运行辣鸡 Bing 今日美图 API 的环境要求
2. [在这里](https://github.com/Minecraft-LittleQiu/laji-bing-pic-api/releases)下载辣鸡 Bing 今日美图 API,并放置到你的 Web 引擎的站点目录下
3. 安装完成后,访问 ``http://your-domain.com/bingpic.php`` 检查是否有报错
4. 还有别的步骤么——没有了!
3. 修改 ```settings.php``` 中的设置
4. 安装完成后,访问 ``http://your-domain.com/bingpic.php`` 检查是否有报错
5. 还有别的步骤么——没有了!

### 如何使用?

Expand Down
14 changes: 11 additions & 3 deletions bingpic.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,27 @@

/*
辣鸡 Bing 今日美图 API By Little_Qiu
Version: 1.0
Version: 1.1
感谢 @GPlane
*/

// 检查 PHP 版本(然而并没有什么卵用)
// 检查 PHP 版本(然而并没有什么卵用)
if (version_compare(PHP_VERSION, '5.2.0', '<')) {
exit('错误:辣鸡 Bing 今日美图 API 要求 PHP 版本不低于 5.2.0,你正在使用的是 '.PHP_VERSION);
}

// 获取 Bing 今日美图的图片地址
function bg() {
$data = json_decode(file_get_contents('http://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1'), true);

// 导入设置
include 'settings.php';

// 获取 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 跳转
Expand Down
6 changes: 6 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

// 设置时间(几天前),将 0 修改为你需要的时间
$daysago = '0';

?>

0 comments on commit 3581c18

Please sign in to comment.