public function getCaptcha_good() { $json = $_POST['params']; $params = json_decode($json, TRUE); $phone = $params['phone']; $input_res = $params['input_res']; $str = "0123456789"; $result = ""; for ($i = 0; $i < 6; $i++) { $num[$i] = rand(0, 9); $result .= $str[$num[$i]]; } session("captcha", $result); session("captchaPhone", $phone); sendCaptcha($phone, $result, $params['captchaType']); $this->success("已发送验证码"); // 调用第三方接口完成短信的发送 sendCaptcha($phone, $result, $params['captchaType']); $this->success("已发送验证码"); }
public function getCaptcha_ok() { $phone = I('phone'); $str = "0123456789"; $result = ""; for ($i = 0; $i < 6; $i++) { $num[$i] = rand(0, 9); $result .= $str[$num[$i]]; } session("captcha", $result); session("captchaPhone", $phone); // 调用第三方接口完成短信的发送 sendCaptcha($phone, $result, ''); $this->success("已发送验证码"); }
/** * 获取验证码 */ public function getPhoneCaptcha() { $phone = ""; $must = array("phone"); $params = haskey($this->params, $must); if ($params == NULL) { $phone = $this->params['phone']; $str = "0123456789"; $result = ""; for ($i = 0; $i < 6; $i++) { $num[$i] = rand(0, 9); $result .= $str[$num[$i]]; } session("captcha", $result); //调用第三方接口完成短信的发送 sendCaptcha($phone, $result); $this->success($result); } else { } }