ZF学习之新建控制器

image

目录结构如图所示

channel.php内容与index.php相仿~

ChannleController.php:

class ChannelController extends Zend_Controller_Action
  {
      public $registry;
      public $view;

      function init()
      {
      }

      function indexAction()
      {
          $this->view->title = 'index/index';
      }

      function lifeAction()
      {
          $this->view->title = 'index/life';
      }

      function doAction()
      {
          $this->view->title = 'index/do';
      }

      function addAction()
      {
          $this->view->title = 'index/add';
      }
  }

|-channel

|—index.pthml

|—life.phtml

|—do.phtml

life.phtml

<title>
<?php
echo $this->title;
?>
</title>

测试:http://zf.zaric.com/channel/life

image 
原文地址:https://www.cnblogs.com/zaric/p/1957754.html