[英]ReflectionException in Route.php line 281: Function () does not exist
[英]ReflectionException in Route.php line
<?php
class Myform extends Controller
{
public function index()
{
return view('form');
}
}
?>
路線的代碼
Route::get('/myform', 'Myform@ndex');
而錯誤是
Route.php第264行中的ReflectionException:方法App \\ Http \\ Controllers \\ Myform :: ndex()不存在
改變
Route::get('/myform', 'Myform@ndex');
至
Route::get('/myform', 'Myform@index');
你輸入了錯誤索引而不是ndex
Route::get('/myform', 'Myform@index');
代替
Route::get('/myform', 'Myform@ndex');
刪除/
在myform
之前,你不需要把它。
聲明路由如下: Route::get('myform', 'Myform@index');
在你的控制器文件中添加namespace App\\Http\\Controllers;
在代碼的頂部。
<?php
namespace App\Http\Controllers;
class Myform extends Controller
{
public function index()
{
return view('form');
}
}
?>
希望這會奏效。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.