需求如题,因为取到json_decode是obj
1.
$a = new \stdClass();
$a->{0} = "test";
var_dump($a); //object(stdClass)#1 (1) { ["0"]=> string(4) "test" }
echo $a->{0}; //test
2.
json_decode(string , true); //加个true获取到的就是array
需求如题,因为取到json_decode是obj
1.
$a = new \stdClass();
$a->{0} = "test";
var_dump($a); //object(stdClass)#1 (1) { ["0"]=> string(4) "test" }
echo $a->{0}; //test
2.
json_decode(string , true); //加个true获取到的就是array