我正在尝试遍历从 api 获取的数组值。在邮递员中我发送数据如下 key Value item_id_array[] [7,1]我使用 x-www-form-urlencoded 从 api 发送数据。之后,当我尝试遍历值时$item_id_array = $request->get('item_id_array');dd($item_id_array );//output shows array:1 [ 0 => "[7,1]" ]但我想要它就像array:1 [ 0 => 7 1 => 1]我正在使用 laravel 5.6 和post方法。提前致谢
1 回答

哆啦的时光机
TA贡献1779条经验 获得超6个赞
在 http 请求中发送数组以供 PHP 解析的最佳方法是单独发送数组项,如下所示:
?item_id_array[]=1&item_id_array[]=7
在邮递员中,您只需使用相同的密钥发送两件物品即可
key Value
item_id_array[] 7
item_id_array[] 1
- 1 回答
- 0 关注
- 78 浏览
添加回答
举报
0/150
提交
取消