问题
I am using zend framework with windows XP and WAMP server.
I have created zend project using following DOS commands:
SET PATH=%PATH%;C:\wamp\bin\php\php5.3.0
C:\>wamp\www> C:\wamp\www\ZendFramework\bin\zf.bat create project test
and my project is created at:
C:\wamp\www\test
Now I have two questions. Q.1: In which folder I will run my create controller zend command using DOS?
C:\wamp\www\test>
or
C:\wamp\www\test\application\controller>
Q:2 I have tried both above folder locations to run create controller command. I have following error. how to solve this?
COMMAND
C:\>wamp\www\test> C:\wamp\www\ZendFramework\bin\zf.bat create controller test
ERROR:
Fatal Error: Cannot Redeclare class Zend_Loader in C:\wamp\www\test\library\Zend\Loader.php on line 31
Thanks
回答1:
See this related post. If you have copied the ZF framework to the C:\wammp\www\test\library folder then you will need to comment out this line in your test\application\configs\application.ini file so that the ZEND_LOADER class isn't included twice:
;includePaths.library = APPLICATION_PATH "/../library"
回答2:
Using xampp the procedure looks like this:
Create Project
working directory: htdocs
zf.bat create project zftest
cd zftest
Create module
working directory: htdocs/zftest
zf.bat create module testmodule
Create controller
working directory: htdocs/zftest
zf.bat create controller testcontroller index-action testmodule
Notice the working directory of each command
Xampp is an application stack for several different platforms, it's use is mainly to be able to setup a working development platform in a fast and effecient way.
The indexaction parameter is there to create a default index action in the created controller.
来源:https://stackoverflow.com/questions/1734166/zend-framework-how-to-create-controller-in-winxp-on-command-line