Twig and Codeigniter error : Call to a member function flashdata() on null
Twig and Codeigniter error : Call to a member function flashdata() on null
我正在尝试在 twig 库中添加一个 codeigniter 函数 $this->session->flashdata()
。但是我遇到以下错误:
Type: Error
Message: Call to a member function flashdata() on null
我在 twig 库的代码是:
$this->twig->addFunction(new Twig_SimpleFunction('flash_data', function($data){return $this->session->flashdata($data);}));
在我的树枝文件中,我这样调用:{{ flash_data('login_error') }}
$this->twig->addFunction(new Twig_SimpleFunction('flash_data', function($data){
$obj =& get_instance();
return $obj->session->flashdata($data);
}));
我正在尝试在 twig 库中添加一个 codeigniter 函数 $this->session->flashdata()
。但是我遇到以下错误:
Type: Error
Message: Call to a member function flashdata() on null
我在 twig 库的代码是:
$this->twig->addFunction(new Twig_SimpleFunction('flash_data', function($data){return $this->session->flashdata($data);}));
在我的树枝文件中,我这样调用:{{ flash_data('login_error') }}
$this->twig->addFunction(new Twig_SimpleFunction('flash_data', function($data){
$obj =& get_instance();
return $obj->session->flashdata($data);
}));