本文介绍了Controller :: detect()在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 Illuminate\Routing\Controllers\Controller::detect() in C:\wamp\www\travless\app\routes.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.

这篇关于Controller :: detect()在Laravel 4中未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 12:31