Front-end string js object array for php framework thinkphp
// Js Object "script" person [] = new Object (); person [0]. firstname = "Bill"; person [0]. lastname = "Gates"; person [1]. firstname = "Bill"; person [1]. lastname = "Gates"; // Convert the object into a json string var jsonstr = JSON. stringify (person); // pass to php $. post ('URL', {obj: jsonstr}, function (data) {}, 'json'); script // php code public function get_json () {// Obtain the json string // note that it is best not to use the I method provided by the framework to obtain data using the thinkphp framework, because the I method will escape double quotation marks inside the string while filtering the string, result in json parsing failure and return null. If you use the json_last_error () function to obtain the returned message, the returned value may be 4, indicating a syntax error. $ Str = $ _ POST ['obj ']; // parse json $ str = json_decode ($ str );}