问答详情
源自:6-3 Smarty的偱环语句

为什么二维数组索引加关联形式里面的键不能用方括号只能用双引号?

为什么二维数组索引加关联形式里面的键不能用方括号只能用双引号?例如 $res=array (
[0]=>array("id" => "28" ,"username"=> "admin" ,"password" => "admin" ,"age" => "270"),
[1]=>array("id" => "29", "username" => "admin", "password" => "admin" ,"age" => "270"));

  $res=array (
"0"=>array("id" => "28" ,"username"=> "admin" ,"password" => "admin" ,"age" => "270"),
"1"=>array("id" => "29", "username" => "admin", "password" => "admin" ,"age" => "270"));上面执行出来就是Parse error: syntax error, unexpected '[', expecting ')' 下面执行出来就对的

提问者:qq_BeyonceInt_0 2015-12-12 01:19

个回答

  • 晚安sp
    2015-12-12 09:34:54

    规定,