php json_encode()和json_decode()

时间:2023-03-08 21:17:25

json_encode()和json_decode()分别是编译和反编译过程

注意json只接受utf-8编码的字符,所以json_encode()的参数必须是utf-8编码,否则会得到空字符或者null

json_decode($arr,true);   json_decode反编译加true就是变成数组,不加true就是Object

header("Content-type:text/html;charset=utf-8");