|
发表于 2009-1-15 11:56:52
|
显示全部楼层
MY_Controller.phpclass Public_Controller extends Controller { function Public_Controller() { parent::Controller(); //load other stuff $this->load->library('session'); //载入KNDB session 用户类 $this->load->library('auth'); //载入用户类 $this->load->library('validation' ); //载入验证类 $this->load->helper(array('form', 'url' ) );//载入多个辅助函数(用数组的方式) $this->data->user = $this->auth->get_user($this->session->userdata('user_id')); }}// Controllers accessible only by logged in usersclass Auth_Controller extends Public_Controller { function Auth_Controller() { parent:ublic_Controller(); if ($this->data->user === FALSE) { header('Location: '.$this->config->item('base_url').'admin.php/login'); } else { return; } }}
[[i] 本帖最后由 huanghuibin 于 2009-1-15 11:58 编辑 [/i]] |
|