我有一些卷曲代码,当我运行它并回显$ httpResponse = curl_exec($ ch)时,会打印以下内容。我将如何从中单独提取元素?
httpresponse{"access_token":"233408318.617bf98.6adcf10f06d04f8ca7d66ccb61a829ba","user":{"username":"jsniff","bio":"","website":"","profile_picture":"http:\/\/images.ak.instagram.com\/profiles\/anonymousUser.jpg","full_name":"","id":"233408318"}}
答案 0 :(得分:1)
json_decode
领导"httpresponse"
, {
将完成工作
尝试:
print_r(json_decode(substr($httpResponse,12)));
您可以访问对象:
$responseObj=json_decode(substr($httpResponse,12));
echo $responseObj->user->username;