首页 > 代码库 > 百度api获取天气

百度api获取天气

<?php

$city="武汉";
$content = file_get_contents("http://api.map.baidu.com/telematics/v3/weather?location=$city&output=json&ak=5slgyqGDENN7Sy7pw29IUvrZ");
print_r(json_decode($content));
?>