我有json字符串:$json = '{ "comment" : "I don\'t like" }';
$json_array = json_decode($json, true); // decode as array rather than object
现在单个代码之前的反斜杠在这里搞砸了:
foreach($json_array as $key => $value)
{
echo $value;
}
所以我之前试过这个foreach
并解码:
$json = stripslashes($json);
但仍然报错:
错误:为 foreach() 提供的参数无效