数组是用Object封装的。
当我做var_dump
时,这是if object
object(stdClass)#57 (1) { ["string"]=> array(2) { [0]=> string(1) "1" [1]=> string(1) "3" } }
当我做下面的print_r
时是0/p
stdClass Object ( [string] => Array ( [0] => 1 [1] => 3 ) )
请告诉我如何从这个对象访问1和3
试一下
$my_result_array = object(stdClass)#57 (1) { ["string"]=> array(2) { [0]=> string(1) "1" [1]=> string(1) "3" } } ;
echo $my_result_array->string[0];
echo $my_result_array->string[1];
或者你可以试试
$res = $my_result_array->string;
echo $res[0];
echo $res[1];