💻 代码示例
PHP
<?php
$url = 'https://api.8l2.cn/api/weather/?city=北京&apikey=你的密钥';
$result = file_get_contents($url);
$data = json_decode($result, true);
print_r($data);
?>
JavaScript
fetch('https://api.8l2.cn/api/weather/?city=北京&apikey=你的密钥')
.then(res => res.json())
.then(data => console.log(data));
Python
import requests
url = 'https://api.8l2.cn/api/weather/?city=北京&apikey=你的密钥'
response = requests.get(url)
data = response.json()
print(data)