public function doLogin(){
header('Content-Type:text/html;charset=utf-8');
$model=M("users");
$user=$model->where("user_name='{$_POST['user_name']}'")->find();
if($user!=null){
if($user["user_password"]!=$_POST["user_password"]){
echo "<script>alert('密码不正确');window.location.href='index/index'</script>";
die;
}
session_start();
$_SESSION["user_name"]=$user["user_name"];
$this->redirect("index");
}else{
echo "<script>alert('不存在此用户');window.location.href='index/index'</script>";
}
}另外发现个问题:我的登录界面的网址是:http://localhost/wms/index.php/Home/Index/login.html,是不是那个login不应该有那个。html后缀啊,我用的是thinkphp3.2.2版本.
最佳答案