Phpjson_encode. Json_encode only supports UTF-8 format. The Copy code is as follows: $ arrayarray ([0] array ([sale_unit_detail_id] 13 [price] 740000 [geometric_lat] 51.5034 json_encode only supports UTF-8 format.
The code is as follows:
$ Array = array (
[0] => array ([sale_unit_detail_id] => 13 [price] => 740000 [geometric_lat] => 51.50348620 [geometric_lng] =>-0.01710900)
[1] => Array ([sale_unit_detail_id] => 27 [price] => 740000 [geometric_lat] => 51.50348620 [geometric_lng] =>-0.01710900)
);
The above php array json_encode is usually converted into a php array, which is like [[...] [...] but today I encountered a strange problem. when the length of my array reaches 142, it is converted
The format of {'0': {...}, '1': {...} is very strange. json_encode is a magic function.
This is a strange problem when json_encode in php is converted to a json string.
Compare the following two sections of code:
The code is as follows:
$ Menu [0] [0] = "title1 ";
$ Menu [0] [1] = "bar1 ";
$ Menu [0] [2] = "bar2 ";
$ Menu [1] [0] = 'tle2 ';
$ Menu [2] [0] = 'tle3 ';
Echo '& $ menu ='. json_encode ($ menu ).'&';
This will output: & $ menu = [["title1", "bar1", "bar2"], ["title2"], ["title3"] &
The code is as follows:
$ Menu [0] ["title"] = "title1 ";
$ Menu [0] ["bar1"] = "bar1 ";
$ Menu [0] ["bar2"] = "bar2 ";
$ Menu [1] [0] = 'tle2 ';
$ Menu [2] [0] = 'tle3 ';
Echo '& $ menu ='. json_encode ($ menu ).'&';
The output is: & $ menu = [{"title": "title1", "bar1": "bar1", "bar2": "bar2 "}, ["title2"], ["title3"] &
What does it mean? The problem is that {} and [], {} are objects, and [] are arrays !!!! The traversal method is different in non-php scenarios! Json_encode is amazing. it's amazing!
The http://www.bkjia.com/PHPjc/324404.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/324404.htmlTechArticlejson_encode only supports UTF-8 format. the code is as follows: $ array = array ([0] = array ([sale_unit_detail_id] = 13 [price] = 740000 [geometric_lat] = 51. 5034...