2015-11-06 10:12:15 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Home\Controller;
|
|
|
|
|
|
|
|
use Think\Controller;
|
|
|
|
|
|
|
|
class IndexController extends Controller {
|
2015-11-08 15:56:53 +00:00
|
|
|
|
|
|
|
public function Index()
|
|
|
|
{
|
|
|
|
if (!is_login) {
|
|
|
|
$this->redirect(U('Index/Login'),3,"尚未登录 3秒后跳转到登录界面!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-06 10:12:15 +00:00
|
|
|
public function Login($username="", $password="", $verify = null) {
|
|
|
|
if(IS_POST){
|
|
|
|
$User = A ( 'User' );
|
|
|
|
$te = $User->Login ( $username, $password, $verify );
|
|
|
|
dump ( $te );
|
|
|
|
$this->display ();
|
|
|
|
}
|
|
|
|
}
|
2015-11-08 15:56:53 +00:00
|
|
|
/**
|
|
|
|
* 退出登录
|
|
|
|
*/
|
2015-11-06 10:12:15 +00:00
|
|
|
public function Logout() {
|
|
|
|
if (is_login ()) {
|
|
|
|
session ( 'user', null );
|
|
|
|
session ( '[destroy]' );
|
|
|
|
$this->success ( '退出成功!', U ( 'login' ) );
|
|
|
|
} else {
|
|
|
|
$this->redirect ( 'login' );
|
|
|
|
}
|
|
|
|
}
|
2015-11-01 14:25:03 +00:00
|
|
|
}
|