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"
  • 相关阅读:
    poj 1321 棋盘问题 (DFS深度优先搜索)
    HDOJ1312 Red and black(DFS深度优先搜索)
    《数据结构》例1.3
    hdoj1905 Pseudoprime numbers (基础数论)
    百练4003 十六进制转十进制(水题)
    第二天——2.23
    第一天——2.22
    返校——2.21
    被盗号了——2.19
    继续咸鱼——2.18
  • 原文地址:https://www.cnblogs.com/ywkpl/p/1089852.html
Copyright © 2011-2022 走看看