我能够使用...创建新项目
I am able to create new projects with...
zf create project ProjectName
...但是这会在不复制 Zend Framework 库的情况下创建一个项目.所以我将 ZF 复制到我的项目库中并尝试创建一个控制器...
...but this creates a project without copying the Zend Framework library. So I copy ZF into my project library and try to create a controller...
zf create controller auth
...我收到这条消息:
...and I get this message:
Fatal error: Cannot redeclare class Zend_Loader in /home/andrew/Projects/test/library/Zend/Loader.php on line 31
Call Stack:
0.0010 110164 1. {main}() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/bin/zf.php:0
0.0010 110284 2. zf_main() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/bin/zf.php:23
0.0116 685448 3. zf_run() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/bin/zf.php:36
0.0116 685568 4. Zend_Tool_Framework_Client_Console::main() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/bin/zf.php:214
0.0117 686084 5. Zend_Tool_Framework_Client_Abstract->dispatch() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Framework/Client/Console.php:96
0.4133 4366424 6. Zend_Tool_Framework_Client_Abstract->_handleDispatch() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Framework/Client/Abstract.php:227
0.4134 4366424 7. call_user_func_array() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Framework/Client/Abstract.php:308
0.4134 4366424 8. Zend_Tool_Project_Provider_Controller->create() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Framework/Client/Abstract.php:0
0.4134 4366424 9. Zend_Tool_Project_Provider_Abstract->_loadProfile() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Project/Provider/Controller.php:135
0.4135 4366652 10. Zend_Tool_Project_Profile->loadFromFile() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Project/Provider/Abstract.php:136
0.4791 4368888 11. Zend_Tool_Project_Profile_FileParser_Xml->unserialize() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Project/Profile.php:181
0.4850 4424620 12. Zend_Tool_Project_Profile_FileParser_Xml->_lazyLoadContexts() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Project/Profile/FileParser/Xml.php:110
0.4886 4434348 13. Zend_Tool_Project_Profile_Resource->initializeContext() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Project/Profile/FileParser/Xml.php:217
0.4887 4434944 14. Zend_Tool_Project_Context_Zf_BootstrapFile->init() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Project/Profile/Resource.php:226
0.4899 4437540 15. Zend_Application->__construct() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Tool/Project/Context/Zf/BootstrapFile.php:81
0.5137 4548240 16. Zend_Application->setOptions() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Application.php:92
0.5179 4696108 17. Zend_Application->setBootstrap() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Application.php:176
0.5219 4896172 18. Zend_Application_Bootstrap_Bootstrap->__construct() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Application.php:317
0.5223 4902596 19. Zend_Application_Bootstrap_BootstrapAbstract->hasPluginResource() /home/andrew/Projects/test/library/Zend/Application/Bootstrap/Bootstrap.php:49
0.5223 4902596 20. Zend_Application_Bootstrap_BootstrapAbstract->getPluginResource() /home/andrew/Projects/test/library/Zend/Application/Bootstrap/BootstrapAbstract.php:314
0.5223 4902596 21. Zend_Application_Bootstrap_BootstrapAbstract->_loadPluginResource() /home/andrew/Projects/test/library/Zend/Application/Bootstrap/BootstrapAbstract.php:348
0.5223 4902676 22. Zend_Application_Bootstrap_BootstrapAbstract->getPluginLoader() /home/andrew/Projects/test/library/Zend/Application/Bootstrap/BootstrapAbstract.php:701
0.5223 4902760 23. Zend_Loader_Autoloader::autoload() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Loader/Autoloader.php:0
0.5224 4902760 24. call_user_func() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Loader/Autoloader.php:130
0.5224 4902760 25. Zend_Loader_Autoloader->_autoload() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Loader/Autoloader.php:0
0.5224 4902896 26. call_user_func() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Loader/Autoloader.php:474
0.5224 4902956 27. Zend_Loader::loadClass() /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Loader/Autoloader.php:0
0.5241 5000704 28. include('/home/andrew/Projects/test/library/Zend/Loader/PluginLoader.php') /opt/ZendFramework/ZendFramework-1.9.3PL1-minimal/library/Zend/Loader.php:83
0.5251 5057592 29. require_once('/home/andrew/Projects/test/library/Zend/Loader.php') /home/andrew/Projects/test/library/Zend/Loader/PluginLoader.php:27
我的设置有什么问题?我怎样才能让 Zend_Tool 像它应该工作的那样工作?
What is wrong with my setup? How can I get Zend_Tool to work like it's supposed to work?
在你的配置文件 (application.ini) 中用分号注释掉这一行:
In your config file (application.ini) comment out this line with a semicolon:
;includePaths.library = APPLICATION_PATH "/../library"
这将防止 Zend_Loader 被包含两次.
This will prevent Zend_Loader from being included twice.
这篇关于Zend_Tool:致命错误:无法重新声明类 Zend_Loader的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!