本文整理匯總了PHP中Piwik_Common::unserialize_array方法的典型用法代碼示例。如果您正苦於以下問題:PHP Piwik_Common::unserialize_array方法的具體用法?PHP Piwik_Common::unserialize_array怎麽用?PHP Piwik_Common::unserialize_array使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Piwik_Common
的用法示例。
在下文中一共展示了Piwik_Common::unserialize_array方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _retrieveCurrentValue
function _retrieveCurrentValue()
{
$this->current_value = PHP_VERSION;
$url = 'http://php.net/releases/?serialize=1&version=5';
$timeout = Piwik_UpdateCheck::SOCKET_TIMEOUT;
try {
$latestVersion = Piwik::sendHttpRequest($url, $timeout);
$versionInfo = Piwik_Common::unserialize_array($latestVersion);
$this->recommended_value = $versionInfo['version'];
} catch (Exception $e) {
$this->recommended_value = '';
}
}
示例2: loadContentFromCookie
/**
* Load the cookie content into a php array.
* Parses the cookie string to extract the different variables.
* Unserialize the array when necessary.
* Decode the non numeric values that were base64 encoded.
*/
protected function loadContentFromCookie()
{
$cookieStr = $_COOKIE[$this->name];
$values = explode( self::VALUE_SEPARATOR, $cookieStr);
foreach($values as $nameValue)
{
$equalPos = strpos($nameValue, '=');
$varName = substr($nameValue,0,$equalPos);
$varValue = substr($nameValue,$equalPos+1);
// no numeric value are base64 encoded so we need to decode them
if(!is_numeric($varValue))
{
$varValue = base64_decode($varValue);
// some of the values may be serialized array so we try to unserialize it
$varValue = Piwik_Common::unserialize_array($varValue);
}
$this->set($varName, $varValue);
}
}