dqhmtpuy94946 2015-02-28 13:04
浏览 47
已采纳

codeigniter新助手没有加载

i try load custom helper but it is not load and generate error like this

An Error Was Encountered

Unable to load the requested file: helpers/getdata_helper.php

my helper is stored in

Application/helper/getdata.php

my controller is

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');
    }

</div>
  • 写回答

2条回答 默认 最新

  • duancheng8000 2015-02-28 13:55
    关注

    Let's see what des doc says :

    Loading a helper file is quite simple using the following function: $this->load->helper('name');

    Where name is the file name of the helper, without the .php file extension or the "helper" part.

    For example, to load the URL Helper file, which is named url_helper.php, you would do this: $this->load->helper('url');

    It clearly suggests that CI will look for a file named xxx_helper.php. In you case, when load getdata, CI will look for getdata_helper.php inside application/helpers .

    You just have to rename your file to make it work.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀