本文整理汇总了PHP中Encrypt::auth方法的典型用法代码示例。如果您正苦于以下问题:PHP Encrypt::auth方法的具体用法?PHP Encrypt::auth怎么用?PHP Encrypt::auth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Encrypt
的用法示例。
在下文中一共展示了Encrypt::auth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public function get($name, $dec = true, $encKey = '')
{
$enValue = isset($_COOKIE[$name]) ? $_COOKIE[$name] : false;
if (!$enValue) {
return false;
}
if ($dec) {
$encKey = $encKey ?: $this->encCode;
$deValue = Encrypt::auth($enValue, $encKey, 'DECODE');
} else {
$deValue = $value;
}
return $deValue ?: false;
}
示例2: _getUser
public function _getUser()
{
// 解密cas server传来的原始数据
$encKey = $this->cfg['encKey'];
if ($encVal = Encrypt::auth(phpCAS::getUser(), $encKey, 'DECODE')) {
$encVal = json_decode($encVal, true);
if ($this->isAdmin) {
// 获取redis权限
$redis = new \Redis();
$redis->connect($this->cfg['redis']['host'], $this->cfg['redis']['port']);
$redis->select($this->cfg['redis']['dbname']);
$res = unserialize($redis->get('group' . $encVal['ugroup'] . '_' . $this->cfg['siteid']));
$encVal['permMenu'] = unserialize($redis->get('group' . $encVal['ugroup'] . '_' . $this->cfg['siteid']));
}
}
return $encVal ?: false;
}
示例3: encrypt
public function encrypt($siteId, $value)
{
$siteCfg = (include 'siteConfig.php');
$encKey = isset($siteCfg['site'][$siteId]['encKey']) ? $siteCfg['site'][$siteId]['encKey'] : false;
return $encKey ? \Encrypt::auth($value, $encKey, 'ENCODE') : $value;
}