【发布时间】:2015-02-28 13:04:31
【问题描述】:
我尝试加载自定义助手,但它没有加载并生成这样的错误
遇到错误
无法加载请求的文件:helpers/getdata_helper.php
我的助手存储在
应用程序/helper/getdata.php
我的控制器是
class home extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('home_model');
$this->load->helper(array('url','form','language','string'));
$this->load->helper('getdata');
//$this->EE->load->helper('menu_load');
}
public function index()
{
$menu['menu']=$this->home_model->get_menu();
$menu['print_menu']=$this->echoMenu($menu['menu']);
$data['latest']=$this->home_model->get_latest_product();
$this->load->view('header_1',$menu);
$this->load->view('index',$data);
$this->load->view('footer');
}
【问题讨论】:
-
你的助手文件名应该是
Application/helper/getdata_helper.php。 -
我同意上面的评论。另外,您不需要自己加载 getdata,您可以将它放在要加载所有其他帮助程序的数组中。此外,如果您打算在整个站点中使用这些帮助程序,您可能需要考虑在
application\config\autoload.php中自动加载它们
标签: php codeigniter