本文整理匯總了PHP中Prado::unserialize方法的典型用法代碼示例。如果您正苦於以下問題:PHP Prado::unserialize方法的具體用法?PHP Prado::unserialize怎麽用?PHP Prado::unserialize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Prado
的用法示例。
在下文中一共展示了Prado::unserialize方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: load
public function load()
{
if (($cache = $this->getApplication()->getCache()) !== null && ($value = $cache->get(self::CACHE_NAME)) !== false) {
return Prado::unserialize($value);
} else {
if (($content = @file_get_contents($this->getStateFilePath())) !== false) {
return Prado::unserialize($content);
} else {
return null;
}
}
}
示例2: unserialize
/**
* @param TPage
* @param string serialized data
* @return mixed unserialized state data, null if data is corrupted
*/
public static function unserialize($page, $data)
{
$str = base64_decode($data);
if ($str === '') {
return null;
}
if ($str !== false) {
$sm = $page->getApplication()->getSecurityManager();
if ($page->getEnableStateEncryption()) {
$str = $sm->decrypt($str);
}
if ($page->getEnableStateCompression() && extension_loaded('zlib')) {
$str = @gzuncompress($str);
}
if ($page->getEnableStateValidation()) {
if (($str = $sm->validateData($str)) !== false) {
return Prado::unserialize($str);
}
} else {
return Prado::unserialize($str);
}
}
return null;
}
示例3: initApplication
protected function initApplication()
{
if ($this->_configFile !== null) {
if ($this->_cacheFile === null || @filemtime($this->_cacheFile) < filemtime($this->_configFile)) {
$config = new TApplicationConfiguration();
$config->loadFromFile($this->_configFile);
if ($this->_cacheFile !== null) {
file_put_contents($this->_cacheFile, Prado::serialize($config), LOCK_EX);
}
} else {
$config = Prado::unserialize(file_get_contents($this->_cacheFile));
}
$this->applyConfiguration($config, false);
}
if (($serviceID = $this->getRequest()->resolveRequest(array_keys($this->_services))) === null) {
$serviceID = $this->getPageServiceID();
}
$this->startService($serviceID);
}
示例4: getValue
/**
* Retrieves a value from cache with a specified key.
* This is the implementation of the method declared in the parent class.
* @param string a unique key identifying the cached value
* @return string the value stored in cache, false if the value is not in the cache or expired.
*/
protected function getValue($key)
{
$sql = 'SELECT value FROM ' . self::CACHE_TABLE . ' WHERE key=\'' . $key . '\' AND (expire=0 OR expire>' . time() . ') LIMIT 1';
if (($ret = $this->_db->query($sql)) != false && ($row = $ret->fetch(SQLITE_ASSOC)) !== false) {
return Prado::unserialize($row['value']);
} else {
return false;
}
}
示例5: getValue
/**
* Retrieves a value from cache with a specified key.
* This is the implementation of the method declared in the parent class.
* @param string a unique key identifying the cached value
* @return string the value stored in cache, false if the value is not in the cache or expired.
*/
protected function getValue($key)
{
if (!$this->_cacheInitialized) {
$this->initializeCache();
}
try {
$sql = 'SELECT value FROM ' . $this->_cacheTable . ' WHERE itemkey=\'' . $key . '\' AND (expire=0 OR expire>' . time() . ') ORDER BY expire DESC';
$command = $this->getDbConnection()->createCommand($sql);
return Prado::unserialize($command->queryScalar());
} catch (Exception $e) {
$this->initializeCache(true);
return Prado::unserialize($command->queryScalar());
}
}