Php Zend_Cache-”的;数据必须为字符串或设置为自动“U序列化=true”;
我正在尝试使用Zend_缓存缓存阵列,如下所示:Php Zend_Cache-”的;数据必须为字符串或设置为自动“U序列化=true”;,php,zend-framework,Php,Zend Framework,我正在尝试使用Zend_缓存缓存阵列,如下所示: $cache = Zend_Registry::get('cache'); // $data is an array $cache->save($data, 'externalData'); 我得到了这个错误: Message: Datas must be string or set automatic_serialization = true 即使在启动文件中初始化Zend_缓存时自动_序列化设置为true: protected fu
$cache = Zend_Registry::get('cache');
// $data is an array
$cache->save($data, 'externalData');
我得到了这个错误:
Message: Datas must be string or set automatic_serialization = true
即使在启动文件中初始化Zend_缓存时自动_序列化设置为true:
protected function _initCache()
{
$frontend= array('lifetime' => 7200,
'automatic_seralization' => true);
$backend= array('cache_dir' => 'cache');
$this->cache = Zend_Cache::factory('core',
'File',
$frontend,
$backend);
}
是什么原因导致了此错误消息?可能您刚刚出现了复制粘贴错误或打字错误,但是,在您发布的代码中,您有:
$frontend= array('lifetime' => 7200,
'automatic_seralization' => true);
i、 e.您正在将automatic\u serialization
设置为true,而不是automatic\u serialization
:请注意ser-i中的i