在cakephp中无法识别PagesController.php

时间:2011-10-24 17:25:42

标签: php cakephp controller

我已经在我的项目中安装了cakephp2.0,但现在我以前在1.3中工作的所有工作都不再适用于2.0。

例如,PagesController无法识别。当我进入我的索引页面时,我收到一条错误说明

Notice (8): Undefined index:  controller [CORE/Cake/Routing/Dispatcher.php, line 84]

Warning (512): _cake_core_ cache was unable to write 'cake_dev_en-us' to Apc cache [CORE/Cake/Cache/Cache.php, line 310]

Warning (512): _cake_core_ cache was unable to write 'cake_dev_en-us' to Apc cache [CORE/Cake/Cache/Cache.php, line 310]

Missing Controller

Error: Controller could not be found.

Error: Create the class Controller below in file: app/Controller/Controller.php

<? php
class Controller extends AppController {
}

Notice: If you want to customize this error message, create app/View/Errors/missing_controller.ctp 

我没有Controller.php,但我确实有PagesController.php。我希望我的应用识别Pages而不是Controller.php

如何强制它查找Pages而不是Controller.php?谢谢!

2 个答案:

答案 0 :(得分:1)

您需要将项目迁移到2.0,或者只需坚持蛋糕1.3。

http://book.cakephp.org/2.0/en/appendices/2-0-migration-guide.html

答案 1 :(得分:0)

我可以修正错误:Notice (8): Undefined index: controller [CORE/Cake/Routing/Dispatcher.php, line 84]. 在Config / routes.php

中添加此行时
CakePlugin::routes();

require CAKE . 'Config' . DS . 'routes.php';