<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                由于有之前的經驗所以這次很快就能完成登錄頁面的功能實現,實際上十分鐘就可以寫完代碼了,但我劃了大半天的水才搞完。下面我直接粘貼login方法的代碼出來,就不截圖了。 ~~~ /** * 登錄方法 */ public function login(){ // 定義連接數據庫變量 $usernameinfo = Db::name('name'); // 定義獲取表單提交數據方法的變量 $requesta = Request::instance(); $username = input('post.lusername'); $password = input('post.checkpassword'); // 判斷是否post提交 if ($requesta -> isPost()){ // 接受表單數據 $data = input('post.'); // 使用isset來檢測變量是否設置和empty檢測是否為空 if (!isset($data['lusername']) || empty($data['lusername'])){ return $this->error('用戶名不能為空'); } // 檢測密碼是否已經輸入 if (!isset($data['checkpassword']) || empty($data['checkpassword'])){ return $this->error('密碼不能為空'); } // 查詢數據 $iusername = $usernameinfo->where('username',$data['lusername'])->find(); $ipassword = $usernameinfo->where('password',$password)->find(); // 檢測是否準確 if (empty($iusername)){ return $this->error('用戶名或密碼錯誤'); } if (empty($ipassword)){ return $this->error('用戶名或密碼錯誤'); }else{ // 用session記錄登錄信息,susername表示存儲的session命名,$username表示表單輸入的內容 session::set('susername',$username); session::set('password',$password); //跳轉首頁 return $this->redirect(url('index/index/index')); } } } ~~~ 前端頁面主要代碼如下: ~~~ <!DOCTYPE html> <html> <head> <title>登陸頁面</title> <meta charset="utf-8"> <meta name="format-detection" content="telephone=no"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-touch-fullscreen" content="yes"> <meta http-equiv="Access-Control-Allow-Origin" content="*"> <link href="__INDEX__/css/login.css" type="text/css" rel="stylesheet"> <link href="__INDEX__/css/global.css" type="text/css" rel="stylesheet"> <script type="text/javascript" src="__INDEX__/js/login.js"></script> </head> <body> <div class="login"> <div class="login-title"><p>登錄</p> <i></i> </div> <form method="post" action="{:url('index/login/login')}"> <div class="login-bar"> <ul> <li><img src="__INDEX__/images/login_user.png"> <input type="text" class="text" name="lusername" id="lusername" value="{$Request.session.susername}" placeholder="請輸入用戶名" onblur="checklogin(this.value)" /></li> <li><img src="__INDEX__/images/login_pwd.png"> <input type="password" class="psd" name="checkpassword" id="checkpassword" value="{$Request.session.password}" placeholder="請輸入確認密碼" onblur="checkpasswordl()" /></li> <div id="yhm"><p id="check4" style="color: red; font-size: 15px; text-align: center;"></p></div> </ul> </div> <div class="login-btn"> <button class="submit" type="submit">登陸</button> <a href="{:url('index/login/register')}"><div class="login-reg"><p>莫有賬號,先注冊</p></div></a> </div> </form> </div> </body> <script> </script> </html> ~~~ 下面可以看到保存的用戶名和密碼自動填寫 ![](https://box.kancloud.cn/99fcc627a97222fd29d625ad0fdc6d7f_423x478.png) ![](https://box.kancloud.cn/30f7b71ca2859ac77f73458c553c345b_440x728.png) 到這里登錄功能已經實現了,下一步到業務功能的實現了。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看