且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 Laravel 4 中访问包控制器

更新时间:2021-10-03 06:33:28

错误是在路由中包含了控制器路径.我有以下内容:

The mistake was including the controllers path in the route. I had the following:

Route::get('/package', 'VendorPackageControllersHomeController@showWelcome');

正确的用法是:

Route::get('/package', 'VendorPackageHomeController@showWelcome');

在控制器中包含命名空间:

With the namespace included in the controller:

namespace VendorPackage;

控制器应该扩展照明:

IlluminateRoutingControllersController

仍然不能使用包名(例如:Package::HomeController@showWelcome),但我可以使用命名空间.耶.

Still can't use the package name (eg: Package::HomeController@showWelcome), but I can using the namespace. yay.

问题解决了.