本文整理匯總了PHP中Random::word方法的典型用法代碼示例。如果您正苦於以下問題:PHP Random::word方法的具體用法?PHP Random::word怎麽用?PHP Random::word使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Random
的用法示例。
在下文中一共展示了Random::word方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: config
/**
* 獲取cookie配置
* @method config
* @param [string] $name [配置變量名]
* @return [mixed] [description]
* @author NewFuture
*/
private static function config($name)
{
if (!($config = self::$_config)) {
$config = Config::get('cookie');
if (!($key = Kv::get('COOKIE_aes_key'))) {
/*重新生成加密密鑰*/
$key = Random::word(32);
Kv::set('COOKIE_aes_key', $key);
}
$config['key'] = $key;
self::$_config = $config;
}
return isset($config[$name]) ? $config[$name] : null;
}
示例2: POST_emailAction
/**
* 綁定郵箱,發送郵箱驗證信息
* PUT /user/1/email {email:"xx@mail.yunyin.org"}
* @method GET_infoAction
* @param integer $id [description]
* @author NewFuture
*/
public function POST_emailAction($id = 0)
{
$id = $this->auth($id);
$response['status'] = 0;
if (!Input::post('email', $email, 'email')) {
$response['info'] = '無效郵箱';
} elseif (UserModel::getByEmail($email)) {
$response['info'] = '已經綁定過用戶';
} elseif (!Safe::checkTry('bind_email_' . $id)) {
$response['info'] = '發送次數過多,12小時之後重試';
} else {
/*生成驗證碼*/
$name = UserModel::where('id', $id)->get('name');
$code = ['use_id' => $id, 'type' => 1];
$Code = new Model('code');
$Code->delete($code);
$code['code'] = $id . '_' . Random::word(16);
$code['content'] = $email;
/*發送郵件*/
if ($Code->insert($code) && Mail::sendVerify($email, $code['code'], $name)) {
$response['status'] = 1;
$response['info'] = '驗證郵件成功發送至:' . $email;
} else {
$response['info'] = '郵件發送出錯[最多還可重發' . Config::get('try.times') . '次]';
}
}
$this->response = $response;
}
示例3: key
/**
* 獲取加密密鑰
* @method key
* @return [type] [description]
* @author NewFuture
*/
public static function key()
{
if (!($key = Kv::get('COOKIE_aes_key'))) {
/*重新生成加密密鑰*/
$key = Random::word(32);
Kv::set('COOKIE_aes_key', $key);
}
return $key;
}