亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

登錄..........

原創(chuàng) 2019-04-20 00:26:32 378
摘要:<?php namespace app\admin\controller; use think\Controller; use think\facade\Session; class Login extends Controller {     public function&n
<?php

namespace app\admin\controller;

use think\Controller;
use think\facade\Session;
class Login extends Controller
{
    public function index(){
        if (request()->isPost()){
            $data = input('');
            $username = $data['username'];
            $password = md5($data['password']);
            $user = model('user')->where('username',$username)->find();
            if ($user != true){
                $info = ['res' => 0,'msg' => '用戶(hù)名不存在'];
            }elseif($password != $user['password']){
                $info = ['res' => 0,'msg' => '密碼錯(cuò)誤'];
            }else{
                $info = ['res' => 1,'msg' => '登錄成功'];
                Session::set('username',$user['username']);
            }
            return $info;
        }else{
            return $this->fetch();
        }
    }
    public function LoginOut(){
        Session::delete('username');
        $this->redirect('index');
    }
}


批改老師:西門(mén)大官人批改時(shí)間:2019-04-20 13:28:23
老師總結(jié):查詢(xún)數(shù)據(jù)之前,最好先校驗(yàn)一下用戶(hù)輸入的username是否有值

發(fā)佈手記

熱門(mén)詞條