How to create new controller in zend framework [cl

2019-09-27 10:43发布

问题:

i have developed a website in zend framework version 1. now i want to create my another project in zend framework version 2. In version 1 whenever we need to create new module, new controller we used to do it with command line. now when i do it in zf2, i got error 'zf is not defined as external or internal command.'. how do i create module,controller automatically in zf2. i do not know their directory structure in zf2 so would not like to copy paste tutorial controller.
How do i create module,controllers in zf2.

回答1:

I assume you are using Windows as development OS, so download zftool and put it on C:/. Open the console and cd to C:/ then you an try the follow

1) create a zf2 project

zftool.phar create project path/to/project

2) create a new Module

zftool.phar create module ModuleName path/to/my/applicationRoot

3) create a new controller

zftool.phar create controller ControllerName ModuleName path/to/my/applicationRoot

You can discover by yourself all th other functionality just running only zftool.phar on console.

Cheers