How to load helper in pre controller hook action in codeigniter

时间:2019-03-19 14:38:43

标签: codeigniter

I want to load helper in pre controller action, can anyone please help me for that, i am getting error Call to undefined function load_helper(), here is my code for that

$hook['pre_controller'] = function()
{
    $this->CI = get_instance();
    $router =& load_class('Router', 'core','uri','url');
    $helper =& load_helper('uri','url');
    $controller_name = $router->fetch_class();  
    $action_name = $router->fetch_method();  
    try {
       $rc = new ReflectionClass($controller_name);
    } catch (Exception $ex) {
       //redirect(site_url($controller_name.'/overview'));
        $url = site_url($controller_name.'/overview');
        header("Location:".$url);
        exit;
    }
};   

0 个答案:

没有答案