简体   繁体   English

读取 curl php 结果

[英]Read curl php result

I'm doing a curl and getting the JSON result as:我正在做一个 curl 并获得 JSON 结果:

$data = json_decode($result, true);
var_dump($data);
$data = $data["data"];
echo $data;

However, the echo of $data is "{".但是,$data 的回声是“{”。 If I do a var_dump before assigning again the variable I see:如果我在再次分配我看到的变量之前执行 var_dump:

string(727796) "{"data":["base64_image1", "base64_image2",... ]}"

Why am I not able to access the data list?为什么我无法访问数据列表? I just want to do a foreach over this list, but I cannot.我只想在这个列表上做一个 foreach,但我不能。

输出是 json,所以再次尝试 json_decode()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM