2010-02-09 40 views
3

我試圖緩存用Zend_Cache像這樣的數組:Zend_Cache是​​ - 「DATAS必須是字符串或設置automatic_serialization =真正的」

$cache = Zend_Registry::get('cache'); 
// $data is an array 
$cache->save($data, 'externalData'); 

而且我收到此錯誤:

Message: Datas must be string or set automatic_serialization = true 

即使雖然在初始化引導文件中的Zend_Cache時設置了自動序列化:

protected function _initCache() 
{ 
    $frontend= array('lifetime' => 7200, 
        'automatic_seralization' => true); 
    $backend= array('cache_dir' => 'cache'); 
    $this->cache = Zend_Cache::factory('core', 
             'File', 
             $frontend, 
             $backend); 
} 

什麼是c請使用此錯誤消息?

回答

5

也許你只是做了一個複製粘貼錯誤或錯別字的錯誤,但是,在你發佈的代碼,您有:

$frontend= array('lifetime' => 7200, 
       'automatic_seralization' => true); 

即要設置automatic_seralization爲真,而不是automatic_serialization:注意i in ser-i -alization。

+0

是的,這是問題:) – 2010-02-09 21:01:30

相關問題