微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

CakePHP cacheHelper – 未找到appController错误

我将CacheHelper添加到了我的应用程序中.
在我的APP / Config / core.PHP我有
Configure::write('Cache.check',true);

在APP / Config / bootstrap.PHP我有

Configure::write('dispatcher.filters',array(
  'Assetdispatcher','Cachedispatcher'
));

在我的控制器中,我有

public $helpers = array('Text','Cache');
public $cacheAction = "1 hour";

在这个控制器和AppController中没有直接回调.
问题是每个页面只加载一次(例如 – 清除缓存后).第二次要求我回来了

Fatal error

Error: Class 'AppController' not found

如果关闭缓存一切正常.

CakePHP版本是2.2.3

调试日志:

2012-12-24 12:21:00 Error: Fatal error (1): Class 'AppController' not found in    [/Volumes/../app/Controller/NewsController.PHP,line 2]
 2012-12-24 12:21:00 Error: [FatalErrorException] Class 'AppController' not found
 #0 /Volumes/../lib/Cake/Error/ErrorHandler.PHP(161): ErrorHandler::handleFatalError(1,'Class 'AppContr...','/Volumes/Data/D...',2)
 #1 [internal function]: ErrorHandler::handleError(1,'/Volumes/../D...',2,Array)
 #2 /Volumes/../lib/Cake/Core/App.PHP(926): call_user_func('ErrorHandler::h...',1,Array)
 #3 /Volumes/../lib/Cake/Core/App.PHP(899): App::_checkFatalError()
 #4 [internal function]: App::shutdown()
 #5 {main}

NewsController:

<?PHP
class NewsController extends AppController {
public $components = array('Security','Imagetool','Uploader');
public $paginate = array(
        'fields' => array('News.id','News.created'),'limit' => 5,'contain' => array(),'order' => array('News.id' => 'DESC'));

public $helpers = array('Text','Cache');
public $cacheAction = "1 hour";
最终获胜者是…
App :: uses(‘AppController’,’Controller’);在控制器代码的顶部.
App::uses('AppController','Controller');

class NewsController extends AppController {
public $helpers = array('Cache');
public $cacheAction = array(
    'index'  => 48000
);

public function index() {

}
public function clear() {
    clearCache();
}
}

我不知道为什么这还没有包含在食谱中.

原文地址:https://www.jb51.cc/php/135550.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐