Exemplo n.º 1
0
 public function actionSendcode()
 {
     if (!isset($_POST['CellPhone'])) {
         echo '请输入手机号。';
         exit;
     }
     $phone = $_POST['CellPhone'];
     //60秒发送一次验证码
     $time = time() - 60;
     $count = VerifyCode::find()->andWhere(['type' => 1, 'field' => $phone, 'status' => -1])->orderBy('b_time desc')->one();
     if ($time < $count['b_time']) {
         echo '请勿重复点击';
         exit;
     }
     try {
         $result = Port::ValidatePhone($phone);
         if ($result) {
             echo '验证码已发送,请注意查收。';
             exit;
         }
     } catch (ErrorException $ex) {
         echo $ex->getMessage();
         exit;
     }
 }
Exemplo n.º 2
0
 public function actionSendcode_()
 {
     if (!$_POST['CellPhone']) {
         echo '请输入手机号。';
         exit;
     }
     try {
         $phone = $_POST['CellPhone'];
         $result = Port::ValidatePhone($phone);
         if ($result) {
             echo '验证码已发送,请注意查收。';
             exit;
         }
     } catch (ErrorException $ex) {
         echo $ex->getMessage();
         exit;
     }
 }