|
本文实例讲述了Zend Framework教程之Zend_Controller_Plugin插件用法。分享给大家供大家参考,具体如下:
通过Zend_Controller_Plugin可以向前端控制器增加附加的功能。便于w一些特殊功能。以下是Zend_Controller_Plugin的简单介绍。
Zend_Controller_Plugin的基本实现
├── Plugin
│ ├── Abstract.php
│ ├── ActionStack.php
│ ├── Broker.php
│ ├── ErrorHandler.php
│ └── PutHandler.php
Zend_Controller_Plugin_Abstract
abstract class Zend_Controller_Plugin_Abstract
{
protected $_request;
protected $_response;
public function setRequest(Zend_Controller_Request_Abstract $request)
{
$this->_request = $request;
return $this;
}
public function getRequest()
{
return $this->_request;
}
public function setResponse(Zend_Controller_Response_Abstract $response)
{
$this->_response = $response;
return $this;
}
public function getResponse()
{
return $this->_response;
}
/**
* Called before Zend_Controller_Front begins evaluating the
* request against its routes.
*
* @param Zend_Controller_Request_Abstract $request
* @return void
*/
public function routeStartup(Zend_Controller_Request_Abstract $request)
{}
/**
* Called after Zend_Controller_Router exits.
*
* Called after Zend_Controller_Front exits from the router.
*
* @param Zend_Controller_Request_Abstract $request
* @return void
*/
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{}
/**
* Called before Zend_Controller_Front enters its dispatch loop.
*
* @param Zend_Controller_Request_Abstract $request
* @return void
*/
public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
{}
/**
* Called before an action is dispatched by Zend_Controller_Dispatcher.
*
* This callback allows for proxy or filter behavior. By altering the
* request and resetting its dispatched flag (via
* {@link Zend_Controller_Request_Abstract::setDispatched() setDispatched(false)}),
* the current action may be skipped.
*
* @param Zend_Controller_Request_Abstract $request
* @return void
*/
public function preDispatch(Zend_Controller_Request_Abstract $request)
{}
/**
* Called after an action is dispatched by Zend_Controller_Dispatcher.
*
* This callback allows for proxy or filter behavior. By altering the
* request and resetting its dispatched flag (via
* {@link Zend_Controller_Request_Abstract::setDispatched() setDispatched(false)}),
* a new action may be specified for dispatching.
*
* @param Zend_Controller_Request_Abstract $request
* @return void
*/
public function postDispatch(Zend_Controller_Request_Abstract $request)
{}
/**
* Called before Zend_Controller_Front exits its dispatch loop.
*
* @return void
*/
public function dispatchLoopShutdown()
{}
}
|
|