• 欢迎访问好鸭博客网站,WordPress信息,WordPress教程,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站,欢迎加入 QQ群
  • Git主题现已支持滚动公告栏功能,兼容其他浏览器,看到的就是咯,在后台最新消息那里用li标签添加即可。

BingApi,PHP单文件实现的Bing壁纸API

建站 haoduck 3年前 (2021-02-03) 1150次浏览 1个评论

Bing必应壁纸PHP单文件实现的API

Github仓库:https://github.com/peng4740/BingApi
代码直链:
https://raw.githubusercontent.com/peng4740/BingApi/master/index.php

https://cdn.jsdelivr.net/gh/peng4740/BingApi@master/index.php

参数

- day 时间,0是今天,1是前1天,2是前2天,最多前7天。默认今天。
- type pic,url,text 分别是直接跳转图像链接,展示链接,展示图片描述(版权)
- size 图片大小,2k,1920,1080,分别是2K(也可能4k),1920x1080,1080x1920
- resolution 具体的分辨率,会覆盖size参数,具体的分辨率,已知有以下这些

#横屏
1920x1200
1920x1080
1366x768
1280x768
1024x768
800x600
800x480
400x240
320x240
#竖屏
1080x1920
768x1366
768x1280
720x1280
640x480
480x800
240x400
240x320
#正方形(可以作为头像之类的)
320x320
240x240

示例

#无参数,直接跳转今天1920x1080图片
https://haoduck.com/demo/bing/index.php
#直接跳转今天1080x1920图片
https://haoduck.com/demo/bing/index.php?size=1080
#只展示链接
https://haoduck.com/demo/bing/index.php?type=url
https://haoduck.com/demo/bing/index.php?size=1080&type=url
#展示描述
https://haoduck.com/demo/bing/index.php?type=text
https://haoduck.com/demo/bing/index.php?size=1080&type=text
#指定具体的分辨率
https://haoduck.com/demo/bing/index.php?resolution=1920x1200
https://haoduck.com/demo/bing/index.php?resolution=320x320

不懂PHP,一边百度一边写的。代码可读性可能不怎么好。


极客公园 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:BingApi,PHP单文件实现的Bing壁纸API
喜欢 (1)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(1)个小伙伴在吐槽
  1. 可以把json精简一下:$ data = json _decode(@file _get_contents('https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1') , true); 自行删除空格
    TVV2021-02-04 19:05 Reply