如何在codeigniter中使用hook?
我有config / hooks.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$hook['post_controller_constructor'] = array(
'class' => 'init',
'function' => 'start',
'filename' => 'init.php',
'filepath' => 'hooks',
'params' => array('index')
);
然后是init.php
class init {
function start() {
if(strtolower($_SERVER['REQUEST_METHOD']) == 'options') die();
$ci =& get_instance();
$session = $ci->load->library('session');
$tokenAuth = $ci->load->library('tokenAuth');
}
}
如何检查会话或tokenAuth。如果存在??? 感谢。