Files
IMAS/Web/imasBackend/weatherInfo.php
2025-01-10 15:20:33 +08:00

7 lines
476 B
PHP

<?php
header("Access-Control-Allow-Origin: *"); // 允许所有域名访问
header("Access-Control-Allow-Methods: GET, POST, OPTIONS"); // 允许的请求方法
header("Access-Control-Allow-Headers: Content-Type"); // 允许的请求头
header("Content-type:application/json");
$weather = json_decode(file_get_contents('https://restapi.amap.com/v3/weather/weatherInfo?key=12085a54026b8e80ed3f69ec9c328e3e&city=510115&extensions=base&output=JSON'));
echo json_encode($weather);