甲骨文 发表于 2012-11-8 13:57:03

使用HMVC时load library

本帖最后由 甲骨文 于 2012-11-8 14:03 编辑

Module ->Build
Class->Tool
library在 application/library/marketing/Discount.php

代码如下:
class Build_Tool_module extends CI_Controller
{

    // 在不使用HMVC的情况下是OK的
    public function discount()
    {
      $this->load->library('marketing/Discount');

var_dump($this->discount); // null
      print_r($this->discount->buildTool());
    }
}

错误:
A PHP Error was encounteredSeverity: NoticeMessage: Trying to get property of non-objectFilename: core/MY_Loader.phpLine Number: 938
// 错误已修改好了

class Build_Tool_module extends CI_Module
{

    // 在不使用HMVC的情况下是OK的
    public function discount()
    {
      $this->load->library('marketing/Discount');

var_dump($this->discount); // null
      print_r($this->discount->buildTool());
    }
}


Hex 发表于 2013-4-18 13:09:54

discount 改小写
页: [1]
查看完整版本: 使用HMVC时load library