好吧第一步开始编写controller
先按照前面的文章配置好工作环境及目录,还有对应的配置文件,下面就需要在模块下面的Controller文件夹下面创建第一个controller
名字为上一篇中介绍的那般IndexController.php
具体代码如下:
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace home\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use home\Model\Artical;
use home\Form\ArticalForm;
use Zend\Session\SessionManager as Zend_Session_SessionManager;
class IndexController extends AbstractActionController{
public function homeAction(){
echo 'HELLO WORLD!';
}
}
?>
打开浏览器输入本地配置的地址
http://localhost/home/index/home
访问页面要是出现了HELLO WORLD!
那就说明你的环境部署以及配置已经成功了。