Fatal error: Class 'AppController' not found

十年热恋 提交于 2019-12-13 09:39:43

问题


We got the error in cakephp 1.3.6. version.No idea why and how, please give your advice or solution.

error: Class 'AppController' not found....... in cakephp 1.3.6.

Thanks

Ajay


回答1:


In your controller class , use at the top as 1st statement

App::uses('AppController', 'Controller');

Because you are extending AppController , so you first need to import it.Like below.

App::uses('AppController', 'Controller');
class CoursesController extends AppController {/*Your code*/ }



回答2:


Just in case this helps anyone. For me it was a misplaced semicolon in a Cakephp find method which was written in the AppController itself. Cakephp went absolutely crazy and threw this weird error which made no sense. Here's the WRONG CODE which was causing the issue for me, notice the semicolon in the conditions array which was a typo on my part.

$user_data = $this->User->find(
    'first',
    array(
        'conditions' => array(
            'User.cookie' => $cookie_val;
        )
    )
);


来源:https://stackoverflow.com/questions/28208551/fatal-error-class-appcontroller-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!