我有捲曲命令,其輸出如下:json_decode返回空數組
"{"meta":{"code":200},"data":{"username":"monstore","bio":"Art clothing line with our life scary tales as the imagination. [email protected] \/ +6281213162069 \/ BB PIN 293A4565","website":"http:\/\/www.heymonstore.com","profile_picture":"http:\/\/images.ak.instagram.com\/profiles\/profile_4472462_75sq_1354349840.jpg","full_name":"Monstore","counts":{"media":547,"followed_by":6472,"follows":129},"id":"4472462"}}"
這裏的捲曲命令:
$output = curl_exec($ch);
基本上上面是什麼$輸出打印出來。所以我試圖通過這樣做來解碼:
$userinfo = json_decode($output, false);
但是它返回一個空的數組。任何想法爲什麼?
你怎麼知道這是一個空數組?這似乎從5.2開始工作:http://3v4l.org/0hYjb – Passerby
'echo $ output'只打印一個你寫的字符串?如果是這樣,你有兩個額外的引號'''(在開始和結束時) –