Controller::detect() 在 Laravel 4 中未定义

2022-01-08 00:00:00 php laravel laravel-4

尝试在 Laravel 4 (Illuminate) 中注册所有控制器路由时,我收到一条错误消息,方法是添加:

I am getting an error message when trying to register all the controller routes in Laravel 4 (Illuminate) by adding:

Route::controller(Controller::detect());

到我的 routes.php

错误:

Error: Call to undefined method IlluminateRoutingControllersController::detect() in C:wampwww	ravlessappoutes.php line 13

我想他们更改了函数名称,但我不知道在哪里可以找到它,因为它仍然是 alpha 版本并且没有我知道的文档.

I suppose they changed the function name, but I don't know where to find it because it is still an alpha version and there is no documentation I'm aware of.

推荐答案

由于不同文件系统的行为不一致,该函数已在 Laravel 4 中删除.注册控制器的正确方法应该是明确定义您希望在路由文件中使用的每一个.

This function has been removed in Laravel 4 because of inconsistent behavior with varying filesystems. The proper way to register controllers should be to explicitly define each one you wish to use in your routes file.

相关文章