我可以从 Codeigniter 中的 header.php 视图访问控制器操作吗?
Can I access controller action from the header.php view in Codeigniter?
我只想从 CodeIgniter 中的 header.php 文件访问 class 的特定方法。我尝试创建一个助手。但它只是破坏了我所有的页面内容加载。
它说我不能在 header.php 中使用 $this
。
提前致谢。
除了使用 $this
你还可以这样做:
$ci = &get_instance();
并像 $this
一样使用 $ci
例如 $ci->model->function();
我只想从 CodeIgniter 中的 header.php 文件访问 class 的特定方法。我尝试创建一个助手。但它只是破坏了我所有的页面内容加载。
它说我不能在 header.php 中使用 $this
。
提前致谢。
除了使用 $this
你还可以这样做:
$ci = &get_instance();
并像 $this
一样使用 $ci
例如 $ci->model->function();