Home >Backend Development >PHP Tutorial >一个关于json_decode()后显示为空的有关问题
一个关于json_decode()后显示为空的问题
代码如下,$data未转码之前还是正常的json格式数据,一转码直接变成Null了,求教大神帮忙看看是什么问题啊
header("Content-type:text/html;charset=utf-8");<br />$url = "http://218.22.201.163/wic/api.php/early_warning/xcyjservice/U/administrator/P/wic/jw/118.589036,30.055954";<br /> $postUrl = str_replace(' ', '%20', $url);<br /> $param = '';<br /> $curlPost = $param;<br /> $ch = curl_init();<br /> curl_setopt($ch, CURLOPT_URL, $postUrl);<br /> curl_setopt($ch, CURLOPT_HEADER, 0);<br /> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br /> curl_setopt($ch, CURLOPT_POST, 1);<br /> curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);<br /> curl_setopt($ch, CURLOPT_TIMEOUT, 60);<br /> $data = curl_exec($ch);<br /> <br /> curl_close($ch);<br /> //var_dump($data);die;//<br /> var_dump(json_decode($data, true));