将多个参数传递给 Laravel 5 中的控制器
问题描述
在我的应用程序中,用户可以提醒另一个用户有关活动邀请的信息.为此,我需要传递事件 ID 和要邀请的用户的 ID.
In my application, a user has the ability to remind another user about an event invitation. To do that, I need to pass both the IDs of the event, and of the user to be invited.
在我的路由文件中,我有:
In my route file, I have:
在我看来,我有:
在我的控制器中,我有:
In my controller, I have:
但是,当我到达该路线时,收到以下错误:
However, when I hit that route, I receive the following error:
我确定我的视图中存在格式错误,但我一直无法对其进行诊断.有没有更有效的方法将多个参数传递给控制器?
I'm sure I have a formatting error in my view, but I've been unable to diagnose it. Is there a more efficient way to pass multiple arguments to a controller?
推荐答案
当你定义这个路由时:
您是说将向该方法传递单个 URI 参数.
You are saying that a single URI argument will be passed to the method.
尝试传递两个参数,例如:
Try passing the two arguments, like:
查看:
这篇关于将多个参数传递给 Laravel 5 中的控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!