在我的认知中,以下是一致的
<?php
$array['test'] = 'test';
$array['test1'] = 'test1';
$array1['test'] = 'test';
$array1 = [
'test1' => 'test1'
];
但是,昨天ios开发小哥调用接口保存了数据,但是没显示,我一眼就看出来应该是这边的问题。所以我应该是记错了。。。
由此,我是理解错了方括号的用法。
<?php $array['test'] = 'test'; //创建数组 $array['test1'] = 'test1'; //插入数组 $array1['test'] = 'test'; //创建数组 $array1 = [ //创建数组 'test1' => 'test1' ];
也好,修复了我的一个bug,哈哈哈