4

I deployed my app on a remote host and everything works as expected. But when I try to test my code on localhost, it gives me the following error, without any change to the code working on the host:

Fatal error: Class 'AppHelper' not found in [path]

I am using CakePHP 2.1 and MySQL as my default datasource.

I connect to my local database just like to the remote one (with authentication changes):

public $default = array(
    'datasource' => 'Database/Mysql',
    'persistent' => false,
    'host' => 'localhost',
    'login' => 'root',
    'password' => '',
    'database' => 'database',
    'prefix' => '',
    'encoding' => 'utf8',
);

Why isn't this working on my localhost? Thank you

4

1 回答 1

5

两个可能的事情:要么你不知道 2.1 的 AppHelper 要求:http: //book.cakephp.org/2.0/en/appendices/2-1-migration-guide.html

或者你忘记在你的类的最顶部声明​​助手:

 App::uses('AppHelper', 'View/Helper');

尽管如果您不运行任何单元测试,第二个是极不可能的。所以我的赌注是第一个。

于 2012-03-07T11:43:45.287 回答