$res=array ( 0 =>
array ( 'id' => 10003, 'rk' => 1, 'uname' => '1wlt1yb0k69g72t', 'lt' => 2, 'rt' => 13, 'Level' => 2,
), 1 =>
array ( 'id' => 10004, 'rk' => 1, 'uname' => 'wm8dd', 'lt' => 3, 'rt' => 8, 'Level' => 3,
), 2 =>
array ( 'id' => 10005, 'rk' => 1, 'uname' => '346p6oc0', 'lt' => 9, 'rt' => 12, 'Level' => 3,
),
)怎样向res[1]加入一个键值对,location =>'1'。我这样加入 res[1] = [location =>'1'];直接就覆盖了res[1],我又这样,res[1][] = [location =>'1'],结果是加入了一个数组。变成 array ( 'id' => 10004, 'rk' => 1, 'uname' => 'wm8dd', 'lt' => 3, 'rt' => 8, 'Level' => 3, '0'=>array(
location =>'1',
)
)有点不科学,不要那个 0,直接在后面补一个 location =>'1'。
添加回答
举报
0/150
提交
取消