本文整理汇总了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);
}
}