init
Showing
4 changed files
with
56 additions
and
0 deletions
| ... | @@ -11,3 +11,10 @@ defined('BASEPATH') OR exit('No direct script access allowed'); | ... | @@ -11,3 +11,10 @@ defined('BASEPATH') OR exit('No direct script access allowed'); |
| 11 | | https://codeigniter.com/user_guide/general/hooks.html | 11 | | https://codeigniter.com/user_guide/general/hooks.html |
| 12 | | | 12 | | |
| 13 | */ | 13 | */ |
| 14 | $hook['post_controller_constructor'] = array( | ||
| 15 | 'class' => 'CheckLogin', | ||
| 16 | 'function' => 'check', | ||
| 17 | 'filename' => 'CheckLogin.php', | ||
| 18 | 'filepath' => 'hooks', | ||
| 19 | 'params' => array('beer', 'wine', 'snacks') | ||
| 20 | ); | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -4,6 +4,11 @@ defined('BASEPATH') OR exit('No direct script access allowed'); | ... | @@ -4,6 +4,11 @@ defined('BASEPATH') OR exit('No direct script access allowed'); |
| 4 | class Work extends CI_Controller | 4 | class Work extends CI_Controller |
| 5 | { | 5 | { |
| 6 | 6 | ||
| 7 | public function __construct(){ | ||
| 8 | parent::__construct(); | ||
| 9 | $this->load->model(); | ||
| 10 | } | ||
| 11 | |||
| 7 | /** | 12 | /** |
| 8 | * 控制台默认页面 | 13 | * 控制台默认页面 |
| 9 | */ | 14 | */ | ... | ... |
application/hooks/CheckLogin.php
0 → 100644
| 1 | <?php | ||
| 2 | |||
| 3 | class CheckLogin | ||
| 4 | { | ||
| 5 | private $CI; | ||
| 6 | |||
| 7 | public function __construct() | ||
| 8 | { | ||
| 9 | $this->CI = &get_instance(); | ||
| 10 | } | ||
| 11 | |||
| 12 | /** * 权限认证 */ | ||
| 13 | public function check() | ||
| 14 | { | ||
| 15 | |||
| 16 | /*if (preg_match("/admin|base/i", uri_string())) { | ||
| 17 | if(!$this->CI->session->isadmin){ | ||
| 18 | redirect('login'); | ||
| 19 | return; | ||
| 20 | } | ||
| 21 | } | ||
| 22 | if (preg_match('/ucenter/i', uri_string())) { | ||
| 23 | if (!$this->CI->session->islogin) { | ||
| 24 | redirect('login/app'); | ||
| 25 | return; | ||
| 26 | } | ||
| 27 | }*/ | ||
| 28 | } | ||
| 29 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or sign in to post a comment