php5.2 comes with the Json_decode function later, but the format requirements for JSON text strings are very strict. It is likely that the return value obtained using this function is null using the Json_last_error () function to obtain the return value of Json_error_syntax (SYNTAX error). There are several ways in which you can debug the error. 1. The JSON string must be enclosed in double quotation marks $output = str_replace ("'", ' "', $output); 2. The JSON string must be UTF8 encoded $output = iconv (' gbk ', ' UTF8 ', $output); 3. Cannot have extra comma such as: [1, 2,] replace with regular, Preg_replace ('/,\s* ([\]}])/M ', ' $ ', $output)
http://www.bkjia.com/PHPjc/477869.html www.bkjia.com true http://www.bkjia.com/PHPjc/477869.html techarticle php5.2 comes with the Json_decode function later, but the format requirements for JSON text strings are very strict. It is likely that the return value obtained by using this function is null using the Json_last_error () function to get the rebate ...