首页 全部接口 API文档 文章 贡献者 友链 关于
登录/注册

随机图片v1

GET https://api.xunjinlu.fun/api/img/index.php

随机图片API文档

接口简介

随机图片API是一个简洁高效的随机图片分发服务,专为桌面环境设计。用户可以通过访问接口直接获取到高清横屏电脑壁纸图片流,适用于网站背景、桌面美化应用、随机壁纸展示等场景。

请求说明

请求参数

参数名类型是否必填说明
:---:---:---:---
无参数

返回参数

字段名说明
:---:---
image高清横屏电脑壁纸图片流

返回示例

成功返回

{
  "image": "https://example.com/wallpaper.jpg"
}

失败返回

{
  "error": "No image available"
}

错误码说明

错误码含义
:---:---
404没有可用的图片

调用示例

直接访问链接

https://api.xunjinlu.fun/api/img/index.php

cURL命令示例

curl -X GET "https://api.xunjinlu.fun/api/img/index.php"

JavaScript (fetch) 示例

fetch("https://api.xunjinlu.fun/api/img/index.php")
  .then(response => response.json())
  .then(data => {
    console.log(data.image);
  });

jQuery AJAX 示例

$.ajax({
  url: "https://api.xunjinlu.fun/api/img/index.php",
  type: "GET",
  success: function(data) {
    console.log(data.image);
  },
  error: function() {
    console.log("No image available");
  }
});

Python (requests) 示例

import requests

url = "https://api.xunjinlu.fun/api/img/index.php"
response = requests.get(url)
if response.status_code == 200:
print(response.json()['image'])
else:
print("No image available")

PHP (curl) 示例

<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.xunjinlu.fun/api/img/index.php");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);

if ($response) {
$data = json_decode($response, true);
echo $data['image'];
} else {
echo "No image available";
}
?>

HTML (iframe/img/script标签)

<img src="https://api.xunjinlu.fun/api/img/index.php" alt="Random Wallpaper" />