Json_encode only supports utf-8 format that's not much to say.
Copy Code code as follows:
$array = Array (
[0] => Array ([sale_unit_detail_id] => [Price] => 740000 [Geometric_lat] => 51.50348620 [GEOMETRIC_LNG] =& gt;-0.01710900)
[1] => Array ([sale_unit_detail_id] => [Price] => 740000 [Geometric_lat] => 51.50348620 [GEOMETRIC_LNG] =& Gt -0.01710900)
);
The above PHP array json_encode usually transforms the PHP array into a shape like [[...] [...]] Format, but today I came across a strange problem, and when my array length reached 142, I converted it to form
{' 0 ': {..}, ' 1 ': {...} ......} The format is very strange, json_encode a magical function
This is a very strange question when json_encode in PHP is an array of JSON strings.
Compare the following two pieces of code:
Copy Code code as follows:
$menu [0][0] = "Title1";
$menu [0][1] = "BAR1";
$menu [0][2] = "BAR2";
$menu [1][0] = ' title2 ';
$menu [2][0] = ' title3 ';
Echo ' & $menu = '. Json_encode ($menu). ' & ';
This will output:& $menu =[["Title1", "Bar1", "Bar2"],["Title2"],["Title3"]]&
Copy Code code as follows:
$menu [0]["title"] = "title1";
$menu [0]["bar1"] = "bar1";
$menu [0]["bar2"] = "bar2";
$menu [1][0] = ' title2 ';
$menu [2][0] = ' title3 ';
Echo ' & $menu = '. Json_encode ($menu). ' & ';
And this actually output:& $menu =[{"title": "Title1", "bar1": "Bar1", "bar2": "Bar2"},["Title2"],["Title3"]]&
What do you mean? The problem is that {} and [],{} are objects, [] are arrays!!!! In the case of non-PHP traversal when the method is not the same! Json_encode this thing is too magical, magical up let a person a bit depressed!