會(huì)員登錄
會(huì)員登錄
login.php
<?php namespace Admin\Controller; use Think\Controller; class LoginController extends Controller { public function index(){ $admin=D('admin'); if(IS_POST){ if($admin->create($_POST,4)){ if($admin->login()){ $this->success('登錄成功,跳轉(zhuǎn)中...',U('Index/index')); }else{ $this->error('用戶(hù)名或者密碼錯(cuò)誤!'); } }else{ $this->error($admin->getError()); } return; } $this->display(); } }
$_POST,4得的意思是下面model驗(yàn)證時(shí)用第四個(gè)驗(yàn)證條件來(lái)判斷。
在model模型層對(duì)數(shù)據(jù)進(jìn)行驗(yàn)證
輸入賬號(hào)密碼看一下