Codeigniter - Unable to call system's lang() function

[亡魂溺海] 提交于 2020-01-29 17:56:32

问题


Trying to call lang() function that is part of codeigniter's system/helpers (language_helper.php), resulting in a Fatal error

Fatal error: Call to undefined function lang()

$def_actions['add'] = array('name' => lang('carbogrid_add'), 'alias' => 'add', 'url' => $this->add, 'icon' => 'ui-icon-circle-plus', 'toolbar' => TRUE, 'grid' => FALSE);

回答1:


You have to load the helper before doing that:

$this->load->helper('language');

$def_actions['add'] = array('name' => lang('carbogrid_add'), 'alias' => 'add', 'url' => $this->add, 'icon' => 'ui-icon-circle-plus', 'toolbar' => TRUE, 'grid' => FALSE);


来源:https://stackoverflow.com/questions/5716050/codeigniter-unable-to-call-systems-lang-function

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!