本文整理匯總了PHP中Sms::findPwd方法的典型用法代碼示例。如果您正苦於以下問題:PHP Sms::findPwd方法的具體用法?PHP Sms::findPwd怎麽用?PHP Sms::findPwd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sms
的用法示例。
在下文中一共展示了Sms::findPwd方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: POST_phoneAction
/**
* 發送手機驗證碼
* @method POST_phoneAction
* @author NewFuture
*/
public function POST_phoneAction()
{
$response['status'] = 0;
if (!Input::post('phone', $phone, Config::get('regex.phone'))) {
$response['info'] = '手機號格式有誤或者不支持!';
} elseif (!Input::post('account', $account, Config::get('regex.account'))) {
$response['info'] = '賬號有誤,如果賬號忘記請聯係雲印工作人員';
} elseif (!($Printer = PrinterModel::where('account', $account)->field('id,phone')->find())) {
$response['info'] = '尚未注冊';
} elseif (!Safe::checkTry('pwd_phone_' . $account)) {
$response['info'] = '嘗試次數過多,臨時封禁!';
} elseif (!$Printer['phone'] || $Printer['phone'] != $phone) {
$response['info'] = '綁定手機不一致,或者手機號錯誤';
} elseif (!Sms::findPwd($phone, $code = Random::number(6))) {
$response['info'] = '短信發送出錯,請聯係我們!';
} else {
/*發送成功*/
$find = ['id' => $Printer['id'], 'account' => $account, 'code' => strtoupper($code)];
Session::set('find_info_p', $find);
Safe::del('pwd_phone_' . $account);
$response['status'] = 1;
$response['info'] = '驗證短信已發送';
}
$this->response = $response;
}
示例2: POST_phoneAction
/**
* 發送手機驗證碼
* @method POST_phoneAction
* @author NewFuture
*/
public function POST_phoneAction()
{
$response['status'] = 0;
if (!Input::post('phone', $phone, Config::get('regex.phone'))) {
$response['info'] = '手機號格式有誤或者不支持!';
} elseif (!Input::post('number', $number, 'card')) {
$response['info'] = '學號格式有誤!';
} elseif (!Safe::checkTry('pwd_phone_' . $number)) {
$response['info'] = '嘗試次數過多,臨時封禁!';
} elseif (!($user = UserModel::where('number', $number)->field('id,phone')->find())) {
$response['info'] = '尚未注冊,或者學號錯誤';
} elseif (empty($user['phone'])) {
$response['info'] = '未綁定手機號,或者學號錯誤';
} elseif (Encrypt::encryptPhone($phone, $number, $user['id']) != $user['phone']) {
$response['info'] = '綁定手機不一致,或者手機號錯誤';
} elseif (!Sms::findPwd($phone, $code = Random::code(6))) {
$response['info'] = '短信發送出錯,請聯係我們!';
} else {
/*發送成功*/
$find = ['id' => $user['id'], 'number' => $number, 'code' => strtoupper($code)];
Session::set('find_info', $find);
Safe::del('pwd_phone_' . $number);
$response['status'] = 1;
$response['info'] = '短信已發送';
}
$this->response = $response;
}