Zend Framework Distributor Usage

不言
Release: 2023-03-30 13:26:01
Original
1045 people have browsed it

This article mainly introduces the usage of Zend Framework distributor, and analyzes the function, definition and simple usage of Zend Framework distributor in the form of examples. Friends in need can refer to it

The examples of this article describe Zend Framework distributor usage. Share it with everyone for your reference, the details are as follows:

Distribution is to obtain the request object, extract the module name, controller name, action name and optional parameters, and then instantiate the controller and call it the entire process of action.

If the module, controller or action is not found, the default value will be used.

The Zend_Controller_Dispatcher_Standard class specifies that the default value of each controller and action is index, and the default value of the module is default.

This class allows developers to change the default value settings through the setDEfaultController() method, setDefaultAction() method and setDefaultModule() method.

_forward()

Function: Call this method in any action and pass in the action, controller, module and Optional parameters can be used to enter new actions.

Case:

<?php
public function fooAction(){  //定义动作
  //转到当前控制器与模块中的其他动作中
  $this->_forward(&#39;bar&#39;,null,null,array(&#39;baz&#39;=>&#39;bogus&#39;));//第一个参数,表动作;第二个参数,表控制器;第三个参数表示模块
}
public function barAction(){  //定义动作
  //转到当前模块的其他控制器的动作中,FooController::bazAction()
  $this->_forward(&#39;baz&#39;,&#39;foo&#39;,null,array(&#39;baz&#39;=>&#39;bogus&#39;));
}
public function bazAction(){
  //转到其他控制器、其他模块中的动作,Foo_BarController::bazAction()
  $this->_forward(&#39;baz&#39;,&#39;bar&#39;,&#39;foo&#39;,array(&#39;baz&#39;=>&#39;bogus&#39;));
}
Copy after login

##The above is the entire content of this article, thank you Everyone’s reading, please pay attention to the PHP Chinese website for more related content!

Related recommendations:

Zend_Form component implements form submission and displays error prompts

The above is the detailed content of Zend Framework Distributor Usage. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!