我运行ZF 1.11没有问题,并按照性能指南中的说明删除require_once语句.我已经将自动加载器添加到我的索引文件中(正如他们所说的那样(我不明白为什么这不能进入boostrap),但现在我的插件找不到了.
例如,表单使用’DijitElement’装饰器,它返回错误:
Zend_Loader_PluginLoader_Exception: Plugin by name 'DijitElement' was not found in the registry; used paths: Zend_Form_Decorator_: Zend/Form/Decorator/ in C:\wamp\www\cms\library\Zend\Loader\PluginLoader.PHP on line 412
在这个表单构造函数中,我添加了以下内容以尝试修复它而无济于事:
$this->addPrefixPath('Zend_Dojo_Form_Decorator','Zend/Dojo/Form/Decorator','DECORATOR');
如果我重命名装饰器使用’Zend_Dojo_Form_Decorator_DijitElement’而不仅仅是’DijitElement’,我得到:
Plugin by name 'Zend_Dojo_Form_Decorator_DijitElement' was not found in the registry; used paths: Zend_Dojo_Form_Decorator_: Zend/Dojo/Form/Decorator/ Zend_Form_Decorator_: Zend/Form/Decorator/
在我的bootstap中我使用插件缓存,在我删除require_once之前我在构造函数中没有前缀路径工作正常,但在删除后我尝试了有和没有工作.
protected function _initPluginCache() { $path = '/cache/pluginLoaderCache.PHP'; if(file_exists($path)) include_once $path; $loader = new Zend_Loader_PluginLoader(array( 'Zend_View_Helper'=>LIBRARY_PATH.'/Zend/View/Helper/','Zend_Dojo_View_Helper'=>LIBRARY_PATH.'/Zend/Dojo/View/Helper','Zend_Dojo_Form_Decorator'=>'Zend/Dojo/Form/Decorator','Zend_Dojo_Form_Element'=>LIBRARY_PATH.'/Zend/Dojo/Form/Element' )); $loader = Zend_Loader_PluginLoader::setIncludeFileCache($path); }
如何告诉Zend文件的位置?我假设这与我的自动加载器有关,但指南只是说添加这个就可以了:
require_once 'Zend/Loader/Autoloader.PHP'; Zend_Loader_Autoloader::getInstance();
仅供参考,指南在这里http://framework.zend.com/manual/en/performance.classloading.html