public function reg(){
if($_POST["reg"]){
if(md5($_POST['verify'])!=$_SESSION['verify']){
echo"<script>alert('验证码输入错误')</script>";//就是这个地方如果我写exit;就可以看到弹出js对话框,不exit的话,直接重定向了。为什么???
$this->redirect("showReg");
}
if(md5($_POST['password'])!=$_POST['passwordq']){
echo"<script>alert('两次密码不一致')</script>";
$this->redirect("showReg");
}
$userInfo['username']=$_POST['username'];
$userInfo['password']=md5($_POST['password']);
$userInfo['role']=$_POST['role'];
$user=M("user");
$user->add($userInfo);
echo"<script>alert('注册成功')</script>";
$this->redirect('showLogin');
}