澜风语录API
正常可用
一、基础信息
- 接口地址:
http://xilan.icu/Interface/lanfeng.php
- 请求方式:GET
- 支持格式:JSON(默认)、TXT(传参)
- 调用限制:无次数/认证限制
二、参数说明
仅1个可选参数,控制返回格式,不传默认JSON
| 参数名 |
参数值 |
是否必传 |
说明 |
示例URL |
| type |
(默认空值) |
否 |
返回JSON,含content字段 |
http://xilan.icu/Interface/lanfeng.php |
| type |
txt |
否 |
返回纯文本格式 |
http://xilan.icu/Interface/lanfeng.php?type=txt |
三、返回示例
3.1 JSON格式(默认)
{
"content": "插画展的颜色很亮,想和你一起走,听你说喜欢哪幅画,这样我也会喜欢。"
}
3.2 TXT格式(传type=txt)
插画展的颜色很亮,想和你一起走,听你说喜欢哪幅画,这样我也会喜欢。
四、调用示例
4.1 PHP 调用
";
// 调用TXT格式
$txtUrl = 'http://xilan.icu/Interface/lanfeng.php?type=txt';
$txtResponse = file_get_contents($txtUrl);
echo "TXT格式语录:" . $txtResponse;
?>
4.2 Python调用
import requests
json_url = 'http://xilan.icu/Interface/lanfeng.php'
json_data = requests.get(json_url).json()
print("JSON格式语录:", json_data['content'])
txt_url = 'http://xilan.icu/Interface/lanfeng.php?type=txt'
txt_data = requests.get(txt_url).text
print("TXT格式语录:", txt_data)
4.3 JavaScript调用
fetch('http://xilan.icu/Interface/lanfeng.php')
.then(res => res.json())
.then(data => console.log('JSON格式语录:', data.content));
fetch('http://xilan.icu/Interface/lanfeng.php?type=txt')
.then(res => res.text())
.then(text => console.log('TXT格式语录:', text));