我想使用Zend框架的邮件模块。我已经在我的project lib文件夹中提取了所有的Zend lib。
那么我如何加载邮件模块来使用这个模块:http://framework.zend.com/manual/1.0/en/zend.mail.read.html?
我已经试过了:
include("lib/Zend/Loader.php");
Zend_Loader::loadClass('Mail');
$mail = new Zend_Mail_Storage_Pop3(array('host' => 'xxxxx',
'user' => 'xxxxx',
'password' => 'xxxxx'));
我的项目结构是这样的:
-project->lib->Zend->All the Zend lib files
-projects/index.php
例如: Warning: require_once(Zend/Mail/Transport/Abstract.php) [function.require-once]: failed to open stream: No such file or directory
我真的需要手动修改所有的require_once
吗?
但是我在其他模块文件中返回了包含路径的错误。
尝试:
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
参见自动加载器参考:
- http://framework.zend.com/manual/en/learning.autoloading.usage.html
和php的__autoload
函数,如果你想编写自定义的自动加载器
您也可以将带有库的路径添加到include_path
(参见set_include_path
/get_include_path
)
。
set_include_path(implode(PATH_SEPARATOR, array(
'path/to/zend/lib/',
get_include_path(),
)));