我在laravel项目中遇到控制器动作的问题,我不明白为什么,因为一切似乎都很好 。 p>
下面是关于错误部分的路线: p>
Route :: get('/ reminds','RemindController @ index') ;
Route :: get('/ reminds','RemindController @ create');
code> pre>
继承人RemindController.php中定义的create和index方法 file: p>
public function index()
{
$ reminds = Remind :: all();
返回View :: make('remind.index', compact('reminds'));
}
公共函数create()
{
try {
$ listyears = RemindController :: generate_list(date('Y')) -100,101);
$ listmonths = RemindController :: generate_list(1,12);
$ listdays = RemindController :: generate_list(1,31);
返回View :: make('remind.create ',compact('listyears','listmonths','listdays'));
} catch(Exception $ e){
App:abort(404);
}
}
code> pre>
在create.blade.php(提醒视图)中我有这个调用有问题的索引: p>
&lt ; div class =“panel-heading”>
< h2>创建提醒< / h2>
< / div>
< div class =“panel-body”>
{!! Form :: open(['action'=>'RemindController @ index','class'=>'form'])!!}
code> pre>
问题是每次我尝试访问调用提醒创建表单的页面时都会收到错误: p>
ErrorException(E_ERROR)
Action App \ Http \ Controllers \ RemindController @ index 没有定义的。 (查看:C:\ Users \ myusername \ Desktop \ project \ prototype
esources \ views
emind \ create.blade.php)
code> pre>
但是我明确定义了它 。 我不明白 谢谢 p>
div>