laravel 类 App\Http\Controllers\homeController 不存在
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38994417/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Class App\Http\Controllers\homeController does not exist
提问by ako
i'm using laravel 5 , in rutes.php i have this code :
我正在使用 laravel 5,在 rutes.php 我有这个代码:
Route::get('about',"homeController@about");
and in App\Http\Controllers\ i have file homeController.php that contains :
在 App\Http\Controllers\ 中,我有文件 homeController.php,其中包含:
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller as BaseController;
class homeController extends BaseController{
public function about(){
return view::make('about');
}
}
but it throws this error : Class App\Http\Controllers\homeController does not exist . how can i fix it ?
但它抛出这个错误: Class App\Http\Controllers\homeController does not exist 。我该如何解决?
回答by KmasterYC
Change all
全部更改
homeController
To
到
HomeController
回答by user3720250
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller as BaseController;
class homeController extends BaseController{
public function about(){
return view::make('about');
}
}
Should works perfectly. Are you sure that name of file is homeController.php
?
应该可以完美运行。你确定文件名是homeController.php
?
回答by Rohit Khatri
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller as BaseController;
class homeController extends BaseController{
public function about(){
return view::make('about');
}
}