4

我正在为我的应用程序使用cakephp 2.1.1。我有一个控制器,我在这个控制器中使用文件缓存。在控制器的操作中,我使用插件 NUSOAP 调用 SOAPService。

我有两个动作:

1.索引

public function index() {
    $items = Cache::read('items', 'tenMinutes'); //tenMinutes is the configuration of cache

    if($items){
        $service = new Service();
        $items = $service->callService();
        Cache::write('items',$items,'tenMinutes');
    }

    $this->set('items',$items);
}

2. 获取结果

public function get_result() {
    $items = Cache::read('items','tenMinutes');

    if($items){

        //start block code filter items by params  
        ...
        //end

        $service = new Service();
        $result = $service->callService2($items);
        $this->set('result',$result);

    } else {

        //redirect index to load ítems
        $this->redirect(array('controller' =>'controllerName', 'action' => 'index'));
    }
}

缓存的配置是:

Cache::config('tenMinutes', array(
        'engine' => 'File', //[required]
        'duration'=> '10 minutes', //[optional]
        'path' => CACHE, //[optional] use system tmp directory - remember to use absolute path
        'prefix' => 'cake_10_', //[optional]  prefix every cache file with this string
    ));

当我调用 index 操作并且是 cakephp 第一次在缓存中写入时,出现以下错误:

致命错误:无法在第 172 行的 C:\wamp\www\myapp\lib\Cake\View\Helper\HtmlHelper.php 中调用构造函数

我第二次输入索引并且缓存已经填满,我单击按钮将我带到第二个操作(get_result),这将返回相同的错误。

有人能帮我吗?

谢谢

4

1 回答 1

1

HtmlHelper继承自Helper。也许您在项目中的某个地方定义了一个自定义类 Helper,而 HtmlHelper 正尝试使用它的构造函数。

于 2012-04-27T07:17:24.910 回答