zoukankan      html  css  js  c++  java
  • Zend framework 多个Module时控制器名称

    启动文件:index.php

    <?php
    set_include_path('.' . PATH_SEPARATOR . 'lib' . PATH_SEPARATOR . get_include_path());
    include_once "Zend/Loader.php";

    Zend_Loader
    ::loadClass('Zend_Controller_Front');
    $frontController = Zend_Controller_Front::getInstance(); 
    $frontController->setParam('noViewRenderer', true);
    $frontController->setControllerDirectory(
                                            
    array(
                                                
    'test'=>'app/test/controllers',
                                                
    'default'=>'app/default/controllers'
                                                )
                                            );
    $frontController->throwExceptions(true);
    $frontController->dispatch();
    ?>
    设定默认模块的控制器
    class indexController extends Zend_Controller_Action{
        public function indexAction(){
            /*....*/
        }
    }
    没有问题

    在设定test模块的控制器的时候
    class indexController extends Zend_Controller_Action{
        public function indexAction(){
            echo 'this test controller test';
        }
    会出现错误


    正确形式为:
    class Test_indexController extends Zend_Controller_Action{
        public function indexAction(){
            echo 'this test controller test';
        }
    }

    控制器命名必须是: "Module" + "_" + "Controller" + "Action"
  • 相关阅读:
    C51中的 xbyte的使用
    使用正则表达式替换日期格式
    C#制作windows窗体的图书管理系统
    《短码之美》读书笔记3
    VS2019创建第一个ASP.NET网站
    观影大数据分析(上)
    Git提交文件报错解决
    软件设计简单工厂模式
    记录一次MySQL启动异常的解决
    将本机web项目映射到公网访问
  • 原文地址:https://www.cnblogs.com/ywkpl/p/1089852.html
Copyright © 2011-2022 走看看