我已经为我的 Zend_Application 引导程序编写了自定义资源。
在手册中,为加载它们提供了以下代码:
$application = new Zend_Application(APPLICATION_ENV, array(
'pluginPaths' => array(
'My_Resource' => APPLICATION_PATH . '/resources/',
),
'resources' => array(
'FrontController' => array(
'controllerDirectory' => APPLICATION_PATH . '/controllers',
),
),
));
然而,这并没有使用我想要使用的 application.ini。是否有可能从我的 application.ini 完全配置它?
我的最终解决方案:(在 Will 的帮助下):
- 使用 zf.sh 创建一个空项目 create project (version 1.9.6)
在 application/resources/Ftp.php 中创建以下类
class My_Resource_Ftp extends Zend_Application_Resource_ResourceAbstract { protected $_params = array(); public function init() { echo "init invoked"; return array("hey"); } }
以下application.ini
[production] phpSettings.display_startup_errors = 0 phpSettings.display_errors = 0 includePaths.library = APPLICATION_PATH "/../library" bootstrap.path = APPLICATION_PATH "/Bootstrap.php" bootstrap.class = "Bootstrap" pluginPaths.My_Resource = APPLICATION_PATH "/resources/" resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" resources.ftp.username = "me" [staging : production] [testing : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 [development : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1