获取json:
function dejson($str){
$str = preg_replace('/\\\"([^"]*)\\\"/',"“$1”",$str);
$str = stripslashes($str);
$str = str_replace("\\", '\\\\', $str);
$str = str_replace("\t", '\\t', $str);
$str = str_replace("\r\n", '\n', $str);
return json_decode($str, true);
}
写入json:
json_encode($arr,JSON_UNESCAPED_UNICODE);