调用和处理:
$re=M()->query("call return_reg_info('".$result['email']."','"
.$result['tel']."','".$_POST['tel_code']."','".$result['username']."','".
$result['password']."','".$result['reg_ip']."','".$result['u_group']."')");
$info=$re[0]['errinfo'];
if($info==='code_timeout')$this->ajaxReturn(array("status"=>"error","msg"=>"验证码已失效!!"));
elseif($info==='code_error')$this->ajaxReturn(array("status"=>"error","msg"=>"验证码填写错误!"));
elseif($info==='code_null')$this->ajaxReturn(array("status"=>"error","msg"=>"该手机号的验证码不存在!"));
elseif($info==='reg_error')$this->ajaxReturn(array("status"=>"error","msg"=>"注册失败或系统繁忙!"));
elseif(preg_match('/^\d{1,}$/',$info)&&!empty($info)){
//注册成功,返回了uid
if(is_weixin()){
$menu=I('post.menu','');
$this->ajaxReturn(array('status'=>'yes','msg'=>U('Weixin/'.$menu)."?username=".$name."&tel=".$tel."uid=".$uid));
}
else $this->ajaxReturn(array('status'=>'yes','msg'=>U('Index/index')));
}else $this->ajaxReturn(array("status"=>"error","msg"=>"注册失败或系统繁忙!"));
储存过程:
DROP PROCEDURE IF EXISTS `return_reg_info`;
DELIMITER ;;