本文整理匯總了PHP中Crypt::with方法的典型用法代碼示例。如果您正苦於以下問題:PHP Crypt::with方法的具體用法?PHP Crypt::with怎麽用?PHP Crypt::with使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Crypt
的用法示例。
在下文中一共展示了Crypt::with方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: cryptValue
/**
* Encrypt value according to the field crypt property
*
* @param string $value
* @return string
*/
public function cryptValue($value)
{
load_class('Q\\Crypt');
return empty($this['crypt']) || !isset($value) ? $value : Crypt::with($this['crypt'])->encrypt($value);
}
示例2: checksum
/**
* Return a checksum hash to identify the user and session.
*
* @param string $salt
* @return string
*/
public function checksum($salt = null)
{
if (!isset($this->info) && !$this->getInfo()) {
return null;
}
if (is_string($this->store)) {
$this->store = extract_dsn($this->store);
}
if (!$this->checksumCrypt instanceof Crypt) {
$this->checksumCrypt = Crypt::with($this->checksumCrypt);
}
if (empty($this->checksumCrypt->secret) && !$this->checksumPassword) {
throw new Exception("To create a checksum, either the password needs to be included or a secret key needs to be used.");
}
return $this->checksumCrypt->encrypt((isset($this->info['uid']) ? $this->info['uid'] : $this->info['username']) . ($this->checksumPassword ? $this->getUser()->getPassword() : null) . ($this->checksumClientIp ? HTTP::getClientRoute() : null) . ($this->store['driver'] == 'session' ? session_id() : null), $salt);
}