[英]API REST php - How to String (file_get_contents) to an ARRAY?
I have this code:我有这个代码:
$res = file_get_contents("http://localhost:8080/restcolitas");
echo $res;
只需使用json_decode()函数
$res = json_decode($res);
The contents of the file seems to be a json.该文件的内容似乎是一个json。 You can do somethings like this :你可以这样做:
$res = file_get_contents("http://localhost:8080/restcolitas");
$jsonToArray = json_decode($res, TRUE);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.