thinkPHP部署到虚拟主机了出现的问题

浏览:4778 发布日期:2017/01/20 分类:求助交流
thinkPHP部署到虚拟主机了出现的问题,部署到虚拟主机了,上面是PHP5.5版本,一直报错,后来改成PHP5.4版本了,可以了,然后登陆页面,本地环境是好好的,通过ajax提交的请求,然后正确的话会alert一个登陆成功,我发现线上的所有的通过ajax返回的状态,都不会弹窗了,不知道怎么回事,好奇怪,百度了很久了,也木有找到一个合适的方案,希望大神们不吝赐教,谢谢
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>后台管理系统</title>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  
  <style>
   
  *{font-family:微软雅黑;margin:0;padding:0;overflow-x:hidden;
    overflow-y:hidden;}
  div{border:0px solid;}
  .menu_top li{list-style:none;float:left;width:20%;font-size:20px;}
  .hzhb li{list-style:none;float:left;font-size:15.4px;line-height:25px;}
  .left_menu{width:90%;margin:0 auto;}
  .left_menu li{list-style:none;}
  .input{height:35px;width:70%;}
  .submit{width:100px;height:40px;font-size:20px;background:#FFB90F;border:none;border-radius:5px;color:#fff;}
  .select_jzc{width:100px;height:35px;}
  input{height:30px;width:200px;}
   .reset{width:100px;height:40px;font-size:20px;background:#FF83FA;border:none;border-radius:5px;color:#fff;}
 
  </style>
 </head>

 <body>


<div style="height:100%;width:100%;margin:0 auto;background:#FFFACD;padding-top:10%;">
    <div style="width:40%;height:230px;background:#FFBBFF;margin:0 auto;padding-top:20px;box-shadow: 5px 5px 5px #FF82AB;
">
        <div style="width:100%;height:50px;">
            <div style="width:34%;height:100%;float:left;line-height:50px;text-align:right;">用户名</div>
            <div style="width:65%;height:100%;float:left;line-height:50px;">
                :<input type="text" name="username" class="username"/>
            </div>
        </div>
        <div style="width:100%;height:50px;">
            <div style="width:34%;height:100%;float:left;line-height:50px;text-align:right;">密 码</div>
            <div style="width:65%;height:100%;float:left;line-height:50px;">
                :<input type="text" name="password" class="pwd"/>
            </div>
        </div>
        <div style="width:100%;height:50px;">
            <div style="width:34%;height:100%;float:left;line-height:50px;text-align:right;">验证码</div>
            <div style="width:65%;height:100%;float:left;line-height:50px;">
                :<input type="text" name="yzm" />
            </div>
        </div>
        
        <div style="width:100%;height:70px;">
            <div style="width:100%;height:100%;line-height:70px;text-align:center;">
                  <button class="submit">登 录</button>
                  <input type="reset" class="reset" value="重 置" />
            </div>
            
        </div>
    
    </div>
  
 
  
  

  
</div>

<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Js/jquery-1.9.1.js"></script>
<script type="text/javascript">
   $(function(){        
        $(".submit").click(function(){                
            var url2 = "__URL__/login";            
            var username = $(".username").val();
            var pwd = $(".pwd").val();
            if(username == ""){
                alert("用户名不能为空!");
                $(".username").focus();
                return false;
            }
            if(pwd == ""){
                alert("密码不能为空!");
                $(".pwd").focus();
                return false;
            }
            $.ajax({
                url:url2,
                data:{'username':username,'password':pwd},
                datatype:'json',
                type:'post',                
                success:function(res){
                    if(res.status == 1){
                        alert('登录成功!');
                        window.location.href="__ROOT__/admin.php/Home/Index/show";
                    }else{
                        alert("登录失败!");
                    }
                }
                
            })
        })
            
   }) 
</script>
 </body>
</html>
 
public function login(){
$username = $_POST['username'];
$password = $_POST['password'];

//var_dump($_POST);
//exit;
$user = M("Admin"); // 实例化User对象
$result = $user->where('username='.$username. ' AND password='.$password)->find();
//echo $user->getLastSql();
if($result){
$data['status']=1;
$user = session('loginname',$username);
//$this->assign('user',$user);
$this->ajaxReturn($data,'json');
}else{
$data['status']=0;
$this->ajaxReturn($data,'json');
}

}
最佳答案
评论( 相关
后面还有条评论,点击查看>>