[英]ReflectionException in Route.php line
<?php
class Myform extends Controller
{
public function index()
{
return view('form');
}
}
?>
the code of routes 路线的代码
Route::get('/myform', 'Myform@ndex');
and the error is 而错误是
ReflectionException in Route.php line 264: Method App\\Http\\Controllers\\Myform::ndex() does not exist Route.php第264行中的ReflectionException:方法App \\ Http \\ Controllers \\ Myform :: ndex()不存在
change from 改变
Route::get('/myform', 'Myform@ndex');
to 至
Route::get('/myform', 'Myform@index');
You did a typing mistake index instead of ndex 你输入了错误索引而不是ndex
Route::get('/myform', 'Myform@index');
instead 代替
Route::get('/myform', 'Myform@ndex');
Remove /
before myform
, you don't need to put it. 删除/
在myform
之前,你不需要把它。
Declare the route as follows: Route::get('myform', 'Myform@index');
声明路由如下: Route::get('myform', 'Myform@index');
In your controller file add namespace App\\Http\\Controllers;
在你的控制器文件中添加namespace App\\Http\\Controllers;
at the top of your code. 在代码的顶部。
<?php
namespace App\Http\Controllers;
class Myform extends Controller
{
public function index()
{
return view('form');
}
}
?>
Hope this will work. 希望这会奏效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.