如何读取从表单转发器发布的数组最好的是从表单帖子中获得的数组..Array ( [products] => Array ( [0] => Array ( [pid] => 1 [qty] => 2 ) [1] => Array ( [pid] => 1 [qty] => 2 ) [2] => Array ( [pid] => 1 [qty] => 2 ) ) )我的问题是如何读取这样的值:$pid[1]= 1$数量[1] = 1
1 回答
当年话下
TA贡献1890条经验 获得超9个赞
您可以像这样访问数组值。
<?php
$array = array("products"=> [["pid" => 1 , "qty" => 2 ],
["pid" => 2 , "qty" => 3 ],
["pid" => 3 , "qty" => 4 ]]);
echo "PId: " . $array["products"][0]["pid"] . "<br>";
echo "qty: " . $array["products"][0]["qty"] . "<br><br>";
print_r($array);
?>
- 1 回答
- 0 关注
- 89 浏览
添加回答
举报
0/150
提交
取消