我在使用 Kohana 3.1 时遇到问题。我添加了旧银行 kohana-email 模块,但结果是这样的错误:
ErrorException [致命错误]:找不到类“电子邮件”
我的应用程序 bootstrap.php 文件是这样的:
Kohana::modules(array(
'user' => MODPATH.'user', // Useradmin module
'auth' => MODPATH.'auth', // Basic authentication
// 'cache' => MODPATH.'cache', // Caching with multiple backends
// 'codebench' => MODPATH.'codebench', // Benchmarking tool
'database' => MODPATH.'database', // Database access
// 'image' => MODPATH.'image', // Image manipulation
'orm' => MODPATH.'orm', // Object Relationship Mapping
'kohana-email' => MODPATH.'kohana-email', // Kohana email module
//'email' => MODPATH.'email', // Email module
//'mailer' => MODPATH.'mailer', // Mailer module
'pagination' => MODPATH.'pagination', // Pagination module
'testmod' => MODPATH.'testmod',
// 'unittest' => MODPATH.'unittest', // Unit testing
// 'userguide' => MODPATH.'userguide', // User guide and API documentation
));
如您所见,我尝试使用另一个电子邮件模块(邮件模块和 shadowhand 的电子邮件模块),结果相同。
考虑到错误消息,我只使用这样的 init.php 文件创建了一个模块(名为 testmod):
<?php
die('It works');
?>
然后,在引导程序中添加 testmod 模块,我得到“它可以工作”。
那么,如果其他模块(如 orm、auth、user)工作正常,为什么 kohana-email、emailer 和 mailer 不能工作?
编辑:我必须扩展我的解释:
kohana-email 模块位于 中MODPATH.'kohana-email'
,因为这样做echo MODPATH;
我可以看到正确的模块位置。
我的模块文件树是这样的:
modules (as echo MODPATH says)
|
+-- user (files from user module, this module works right)
|
+-- auth (files from auth module, this module works right)
|
+-- testmod (init.php file from testmod, this module works right)
|
+-- kohana-email
! |
: +-- classes
: | |
: | +-- email.php <--- The Email class is here!
: |
: +-- config
: | |
: | +-- email.php
: |
: +-- vendor
· |
· +-- swift
!
: (files from swift)
·
是的,我Email::connect();
在同一个 bootstrap.php 中,在该Kohana::modules
行之后进行了探测,并且在这里引发了 ErrorException。而且,是的,我用 shadowhand 电子邮件模块探测它,但我得到了同样的错误。
所以,我再问一个问题:
为什么 kohana-email(以及电子邮件和邮件程序)模块不起作用?或者,为什么 kohana 找不到 Email 类?