在PHP中,我们经常会用到json字符串解析和数组转换为字符串。
定义数组
$arr = array(
'name' => '素材火',
'site' => 'www.sucaihuo.com'
);
转变为json字符串
$json_string = json_encode($arr);
转变为json数组
json_decode ( string $json [, bool $assoc ] ) ,第一个参数是json字符串,第二个若为空的话,会转变为对象。
$jsonArr = json_decode($json_string, true);
系统已开启自动识别垃圾评论机制,识别到的自动封号,下载出错或者资源有问题请联系全栈客服QQ 1915635791