Php 如何从这个URL获取JSON数据?
我有一个返回JSON对象的URL,如下所示:Php 如何从这个URL获取JSON数据?,php,json,Php,Json,我有一个返回JSON对象的URL,如下所示: {"ip":"192.168.48.68"} 我想获得ip值。那么如何通过PHP检索它呢?使用json\u decode方法: $json = YOUR_JSON_OBJECT; $ip = json_decode($json, true); //then you can get the ip using its index in the array $ip["ip"] //192.168.48.68 使用json\u decode方法: $js
{"ip":"192.168.48.68"}
我想获得
ip
值。那么如何通过PHP检索它呢?使用json\u decode
方法:
$json = YOUR_JSON_OBJECT;
$ip = json_decode($json, true);
//then you can get the ip using its index in the array
$ip["ip"] //192.168.48.68
使用
json\u decode
方法:
$json = YOUR_JSON_OBJECT;
$ip = json_decode($json, true);
//then you can get the ip using its index in the array
$ip["ip"] //192.168.48.68