JSON string to the background PHP processing problem solution, JSON string
In the development of the project due to the introduction of the batch record array, because of the number of fields, it is impossible to use the normal way &a=322&=gsd&v=rwe so to send, so think of the front end of the JSON format past content=[{' a ': 2321 , ' B ': ' GSD ', ' C ': ' Dww '},{' a ': ' 4sd ', ' B ': ' Gsd2 ', ' C ': ' DWW3 '},.....] , so many records background parsing is also very convenient, but when I pass the background received is [{\ ' a\ ': 2321,\ ' b\ ': \ ' gsd\ ', \ ' c\ ': \ ' dww\ '} ...] such format, and I need the standard JSON format string, The use of PHP Json_decode parsed directly into the array, so I am good operation, to the online search a lot of classmates also met with me the same problem, find a half-day best still did not find the answer, and finally the whole out, stripslashes with PHP in this function, Convert the retrieved JSON string to OK,
In fact, this problem is caused by the GET_MAGIC_QUOTES_GPC () function, if the configuration in the php.ini is off should not have this problem, so the use of this function when added judgment
$json for the received JSON string if (GET_MAGIC_QUOTES_GPC () ==1) { $json = stripslashes ($json);}
Needless to say, two years did not complete the PHP, have forgotten, the recent project needs to go through the handbook
http://www.bkjia.com/PHPjc/1133017.html www.bkjia.com true http://www.bkjia.com/PHPjc/1133017.html techarticle JSON string to the background PHP processing problem resolution, JSON string in the project development due to the introduction of the batch record array, because of the number of fields, it is impossible to use the PU ...