route路由定义
Route::controller('home', 'HomeController');
homeController.php
<?php
namespace App\Http\Controllers;
use App\User;
use App\Http\Controllers;
class HomeController extends Controller
{
public function getIndex()
{
return 'test';
}
}
浏览地址:http://local/home/index
报错:
Whoops, looks like something went wrong.
1/1
InvalidArgumentException in RouteRegistrar.php line 75:
Attribute [controller] does not exist.
in RouteRegistrar.php line 75
at RouteRegistrar->attribute('controller', 'home') in Router.php line 1085
at Router->__call('controller', array('home', 'HomeController')) in Facade.php line 221
at Router->controller('home', 'HomeController') in Facade.php line 221
at Facade::__callStatic('controller', array('home', 'HomeController')) in web.php line 18
at Route::controller('home', 'HomeController') in web.php line 18
at require('F:\\www\\shoe\\routes\\web.php') in Router.php line 314
at Router->loadRoutes('F:\\www\\shoe\\routes/web.php') in Router.php line 270
at Router->group(array('middleware' => 'web', 'namespace' => 'App\\Http\\Controllers'), 'F:\\www\\shoe\\routes/web.php') in RouteRegistrar.php line 104
at RouteRegistrar->group('F:\\www\\shoe\\routes/web.php') in RouteServiceProvider.php line 56
at RouteServiceProvider->mapWebRoutes() in RouteServiceProvider.php line 40
at RouteServiceProvider->map()
at call_user_func_array(array(object(RouteServiceProvider), 'map'), array()) in BoundMethod.php line 29
at BoundMethod::Illuminate\Container\{closure}() in helpers.php line 912
at value(object(Closure)) in BoundMethod.php line 86
at BoundMethod::callBoundMethod(object(Application), array(object(RouteServiceProvider), 'map'), object(Closure)) in BoundMethod.php line 30
at BoundMethod::call(object(Application), array(object(RouteServiceProvider), 'map'), array(), null) in Container.php line 524
at Container->call(array(object(RouteServiceProvider), 'map')) in RouteServiceProvider.php line 69
at RouteServiceProvider->loadRoutes() in RouteServiceProvider.php line 30
at RouteServiceProvider->boot() in RouteServiceProvider.php line 28
at RouteServiceProvider->boot()
at call_user_func_array(array(object(RouteServiceProvider), 'boot'), array()) in BoundMethod.php line 29
at BoundMethod::Illuminate\Container\{closure}() in helpers.php line 912
at value(object(Closure)) in BoundMethod.php line 86
at BoundMethod::callBoundMethod(object(Application), array(object(RouteServiceProvider), 'boot'), object(Closure)) in BoundMethod.php line 30
at BoundMethod::call(object(Application), array(object(RouteServiceProvider), 'boot'), array(), null) in Container.php line 524
at Container->call(array(object(RouteServiceProvider), 'boot')) in Application.php line 762
at Application->bootProvider(object(RouteServiceProvider)) in Application.php line 745
at Application->Illuminate\Foundation\{closure}(object(RouteServiceProvider), 17)
at array_walk(array(object(EventServiceProvider), object(LogServiceProvider), object(RoutingServiceProvider), object(AuthServiceProvider), object(CookieServiceProvider), object(DatabaseServiceProvider), object(EncryptionServiceProvider), object(FilesystemServiceProvider), object(FormRequestServiceProvider), object(FoundationServiceProvider), object(NotificationServiceProvider), object(PaginationServiceProvider), object(SessionServiceProvider), object(ViewServiceProvider), object(AppServiceProvider), object(AuthServiceProvider), object(EventServiceProvider), object(RouteServiceProvider)), object(Closure)) in Application.php line 746
at Application->boot() in BootProviders.php line 17
at BootProviders->bootstrap(object(Application)) in Application.php line 208
at Application->bootstrapWith(array('Illuminate\\Foundation\\Bootstrap\\LoadEnvironmentVariables', 'Illuminate\\Foundation\\Bootstrap\\LoadConfiguration', 'Illuminate\\Foundation\\Bootstrap\\HandleExceptions', 'Illuminate\\Foundation\\Bootstrap\\RegisterFacades', 'Illuminate\\Foundation\\Bootstrap\\RegisterProviders', 'Illuminate\\Foundation\\Bootstrap\\BootProviders')) in Kernel.php line 160
at Kernel->bootstrap() in Kernel.php line 144
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116
at Kernel->handle(object(Request)) in index.php line 54
1 个回复
冰泉
赞同来自:
在L4中是可以的