通常情况下,Controller 中的方法可以通过 $this->config->item('item_name') 的方式来加载配置文件中的值
但是如果不继承 CI_Controller 这个方式就不能用了

这时候可以通过创建来自 CI_Controller 的引用来实现:

$CI =& get_instance();
$item_value = $CI->config->item('item_name');

详见官方文档:

在你的类库中使用 CodeIgniter 资源
http://codeigniter.org.cn/user_guide/general/creating_libraries.html#codeigniter

相关文章:

  • 2022-12-23
  • 2021-07-16
  • 2021-05-12
  • 2021-05-29
  • 2022-01-31
  • 2021-10-25
猜你喜欢
  • 2021-08-12
  • 2021-07-12
  • 2021-08-17
  • 2022-12-23
  • 2021-08-01
  • 2021-12-09
相关资源
相似解决方案