如何在路由中发送数组并接收该数组
我想发送一个数组作为参数进行路由并接收它。这是我的代码
$list = array_filter($list);
return redirect()->route('ucs.mail', serialize($list));
,我的路线是:
Route::get('customer/mail/{list}', 'CustomerActionController@send_mail')->name('ucs.mail');
那么解决方案是什么呢?
I want to send an array to route as parameter and receive this. Here is my code
$list = array_filter($list);
return redirect()->route('ucs.mail', serialize($list));
And my route is:
Route::get('customer/mail/{list}', 'CustomerActionController@send_mail')->name('ucs.mail');
When I try to load the route it will send me following error.
So what is the solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在这里找到了我的解决方案:
方法1:
https://laracasts.com/discuss/channels/laravel/how-to-send-an-array-in-a-route-and-receive-this
方法2:可以解决另一种方式是:
使用 json 编码传递数组参数
并进行 json 解码以在控制器中使用数组。
I found my solution following here:
Method 1:
https://laracasts.com/discuss/channels/laravel/how-to-send-an-array-in-a-route-and-receive-this
Method 2: It can be solved in another way like:
use json encode to pass array parameter
and do json decode to use array in controller.