【发布时间】:2015-05-20 11:53:57
【问题描述】:
这是我的简单控制器:
public function _construct()
{
parent::_construct();
$this->load->helper('url');
}
public function view($page = "index")
{
if ( ! file_exists(APPPATH.'/views/truelove_view/'.$page.'.php'))
{
// Whoops, we don't have a page for that!
show_404();
}
$this->load->view('truelove_view/templates/header.php');
$this->load->view('truelove_view/'.$page);
$this->load->view('truelove_view/templates/footer.php');
当我包含 $this->load->helper('url');在 view() 中,代码可以工作,但是当我将它包含在上面的构造函数中时,它就不行了。如果我自动加载 url helper,它也可以工作。
有什么想法吗?
【问题讨论】:
标签: php codeigniter helper