2012-04-26 116 views
4

我正在爲我的應用使用cakephp 2.1.1。我有一個控制器,並使用此控制器中的文件緩存。在控制器的操作中,我使用插件NUSOAP調用SOAPService。致命錯誤:無法在HtmlHelper.php中調用構造函數(CakePHP)

我有兩個動作:

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. get_result

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 
    )); 

當我打電話指數作用,是CakePHP的高速緩存中寫入第一次我有以下錯誤:

致命錯誤:無法調用構造在C:\ WAMP \ WWW \ MYAPP \ LIB \蛋糕\查看\幫助\ HtmlHelper.php在線172

第二次我輸入索引和緩存已經填充我點擊按鈕帶我到第二個動作(get_result),這會返回我同樣的錯誤。

有人可以幫助我嗎?

感謝

回答

1

的HtmlHelper從助手繼承。 也許你已經在你的項目的某個地方定義了一個自定義類Helper,而HtmlHelper試圖改用它的構造函數。

相關問題