douao2000 2015-06-05 02:17
浏览 48

Kohana没有加载自定义模块类

I have created a module in Kohana but I have a problem when I try to use it. When I try to use the class I get the following error:

ErrorException [ Fatal Error ]: Class 'PopcornInteractor' not found

APPPATH/classes/model/movie.php [ 120 ]
118     public function getPopcorn($popcorn) {
119         $uid = null;
120         $pci = new PopcornInteractor();

The bootstrap.php file has the following configuration for the modules

Kohana::modules(array(
  ...,
  'popcornmod' => MODPATH.'popcornmod'
));

When I debug the Kohana::modules() I get the following structure:

...
popcornmod : "\/var\/www\/html\/mywebsite.com\/modules\/popcornmod\/"

The structure of my files is:

modules                       
+                             
+-+popcornmod                 
   +                          
   +-+classes                 
   |  +                       
   |  +-+PopcornInteractor.php
   |                          
   +-+config                  
   |  +                       
   |  +-+popcornmod.php       
   |                          
   +-+init.php

The PopcornInteractor.php file has the following content:

class PopcornInteractor {
    protected $config;
    function __construct() {
        $this->config = Kohana::$config->load('popcornmod')->as_array();
    }
}

Finally, on the included files message that is shown when the error shows, it displays:

MODPATH/email/vendor/swiftmailer/lib/swift_required.php
MODPATH/email/vendor/swiftmailer/lib/classes/Swift.php
MODPATH/popcornmod/init.php
SYSPATH/classes/cookie.php
SYSPATH/classes/kohana/cookie.php

I try looking for PopcornInteractor.php but it is not in the included files.

The mod was working good in my local installation (OS X) but when I uploaded to the server (Linux) it didn't work.

Any ideas?

  • 写回答

1条回答 默认 最新

  • dtvhqlc57127 2015-06-05 04:25
    关注

    Changed the name of the file and now is working, the final structure is:

    modules                       
    +                             
    +-+popcornmod                 
       +                          
       +-+classes                 
       |  +                       
       |  +-+popcorninteractor.php <-- change: lower cases
       |                          
       +-+config                  
       |  +                       
       |  +-+popcornmod.php       
       |                          
       +-+init.php
    
    评论

报告相同问题?

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制