不多说了,直接分享给大家。要是我不说,你可能一辈子都不知道怎么进后台!当前我做的是简版,还可以弄的更复杂!
'URL_ROUTER_ON' => true, //开启路由
'URL_ROUTE_RULES' => array( //定义路由规则
"/^think(\d{4})/" => "Admin/Login/logincheck?code=:1",
),
//后台登陆系统首页界面
public function index(){
if(isset($_GET['from'])){
$this->error("非法请求!",U('/'),1);
}
$code=$_GET["code"];
$codecheck=date("Hi",NOW_TIME);
if($code!=$codecheck){
$this->error("非法请求",U("/"),1);
}
session_start();
if($_SESSION['username'] && $_SESSION['uid']){
$this->success("您已经登陆!",U("Index/index"),3);
}else{
//读取用户cookie信息
$this->username=isset($_COOKIE["username"])?$_COOKIE["username"]:"";
$this->display();
}
}
public function logincheck(){
$code=$_GET["code"];
$this->redirect('index',array("code"=>$code));
}
最佳答案