결과 구분이 내 쿼리입니다 :과정은 JSON이
$details = json_decode(file_get_contents("http://ipinfo.io/{$ip}"));
$city= $details->city;
주고 결과 :
{
"ip": "210.56.147.31",
"hostname": "No Hostname",
"city": null,
"region": null,
"country": "IN",
"loc": "20.0000,77.0000",
"org": "AS45774 Chandra Net Pvt. Limited, India"
}
나는에 의해 LOC를 얻을 수 있습니다 : echo "loc is : $loc"
loc is : 20.0000,77.0000
: 결과를 제공
$loc= $details->loc;
경도와 lattitu를 가져오고 싶습니다. 드 $long
및 $latt
. 어떻게 할 수 있었 니? 두 값을 어떻게 분리 할 수 있습니까?
$loc= $details->loc[0]; //this is not correct
일반적으로 문자를 기준으로 문자열을 어떻게 분할합니까? – PeeHaa