日期:2014-05-17 浏览次数:20396 次
class Admin_Controller extends CI_Controller { public function __construct() { parent::__construct(); $this->_init_user(); } //初始化用户 private function _init_user() { if(!empty($_SESSION['name'])) { redirect('management'); } else { redirect('login'); } }
class Management extends Admin_Controller { public function index() { $this->load->view('management'); }
class Login extends Admin_Controller { public function index() { $this->load->view('login'); } public function logins() { if($_POST['name'] == "admin" && $_POST['passwd'] == "123456") { $_SESSION['name'] = $_POST['name']; redirect('management'); } else { redirect('login'); } } }