【发布时间】:2016-03-07 20:23:14
【问题描述】:
我只想从 CodeIgniter 中的 header.php 文件中访问某个类的特定方法。我尝试创建一个助手。但它只是破坏了我所有的页面内容加载。
它说我不能在 header.php 中使用$this。
提前致谢。
【问题讨论】:
-
您应该包含您的代码以供参考 =]
标签: codeigniter methods header helper
我只想从 CodeIgniter 中的 header.php 文件中访问某个类的特定方法。我尝试创建一个助手。但它只是破坏了我所有的页面内容加载。
它说我不能在 header.php 中使用$this。
提前致谢。
【问题讨论】:
标签: codeigniter methods header helper
您可以这样做,而不是使用$this:
$ci = &get_instance();
并使用$ci 就像$this
例如$ci->model->function();
【讨论】: