时间:2021-07-01 10:21:17 帮助过:25人阅读
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'); } } }