本文整理汇总了PHP中Random::code方法的典型用法代码示例。如果您正苦于以下问题:PHP Random::code方法的具体用法?PHP Random::code怎么用?PHP Random::code使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Random
的用法示例。
在下文中一共展示了Random::code方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: POST_emailAction
/**
* 通过邮箱找回密码
* @method POST_emailAction
* @author NewFuture
*/
public function POST_emailAction()
{
$response['status'] = 0;
if (!Input::post('email', $email, 'email')) {
$response['info'] = '邮箱格式有误或者不支持!';
} elseif (!Input::post('account', $account, Config::get('regex.account'))) {
$response['info'] = '学号格式有误!';
} elseif (!Safe::checkTry('pwd_email_' . $account)) {
$response['info'] = '尝试次数过多,临时封禁!';
} elseif (!($Printer = PrinterModel::where('account', $account)->field('id,email')->find())) {
$response['info'] = '尚未注册,或者账号错误';
} elseif (empty($Printer['email'])) {
$response['info'] = '未绑定邮箱,或邮箱不存在';
} elseif ($Printer['email'] != $email) {
$response['info'] = '绑定邮箱不一致,或者邮箱错误';
} elseif (!Mail::findPwd($email, $code = Random::code(6))) {
$response['info'] = '邮件发送出错,请联系我们!';
} else {
/*发送成功*/
$find = ['id' => $user['id'], 'account' => $account, 'code' => strtoupper($code)];
Session::set('find_info_p', $find);
Safe::del('pwd_email_' . $account);
$response['status'] = 1;
$response['info'] = '验证邮件已发送!';
}
$this->response = $response;
}
示例2: POST_emailAction
/**
* 通过邮箱找回密码
* @method POST_emailAction
* @author NewFuture
*/
public function POST_emailAction()
{
$response['status'] = 0;
if (!Input::post('email', $email, 'email')) {
$response['info'] = '邮箱格式有误或者不支持!';
} elseif (!Input::post('number', $number, 'card')) {
$response['info'] = '学号格式有误!';
} elseif (!Safe::checkTry('pwd_email_' . $number)) {
$response['info'] = '尝试次数过多,临时封禁!';
} elseif (!($user = UserModel::where('number', $number)->field('id,name,email')->find())) {
$response['info'] = '尚未注册,或者学号错误';
} elseif (empty($user['email'])) {
$response['info'] = '未绑定邮箱,或者学号错误';
} elseif (Encrypt::decryptEmail($user['email']) != $email) {
$response['info'] = '绑定邮箱不一致,或者邮箱错误';
} elseif (!Mail::findPwd($email, $code = Random::code(6), $user['name'])) {
$response['info'] = '邮件发送出错,请联系我们!';
} else {
/*发送成功*/
$findPwd = ['id' => $user['id'], 'number' => $number, 'code' => strtoupper($code)];
Session::set('find_info', $findPwd);
Safe::del('pwd_email_' . $number);
$response['status'] = 1;
$response['info'] = '找回验证码已发送到' . $email;
}
$this->response = $response;
}