初入thinkphp

來源:互聯網
上載者:User

標籤:

    花3天時間入門了php和thinkphp架構,緊接著就做了一個小後台,簡單使用了thinkphp架構封裝的一些類和函數。

現在來總結一下:

           

 1 public function Login()   //登陸函數 2     { 3         if(!IS_POST)   //判斷是否首次調用該函數 4         $this->display(); 5         else 6         { 7            $map[‘user_name‘]=I(‘post.username‘);   //使用I()函數來擷取模板傳來的參數 8            $map[‘user_psd‘]=I(‘post.userpsd‘); 9            if(empty($map[‘user_name‘])||empty($map[‘user_psd‘]))//empty()函數來判斷變數是否為空白10                $this->error(‘使用者名稱或密碼沒寫‘);11           $UserInfo = M(‘zx_admin‘)->where($map)->select();12           if(empty($UserInfo[0][‘user_name‘]))13                $this->error(‘使用者名稱或密碼錯誤‘);14           else15           {16             session(‘user‘,$UserInfo[0]);  //設定session17               $this->success(‘登陸成功‘,U(‘Index/index‘));18           }19                20         }21     }
View Code

 

初入thinkphp

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.