本文整理汇总了PHP中Zend_Controller_Dispatcher_Interface::dispatch方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Dispatcher_Interface::dispatch方法的具体用法?PHP Zend_Controller_Dispatcher_Interface::dispatch怎么用?PHP Zend_Controller_Dispatcher_Interface::dispatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Dispatcher_Interface
的用法示例。
在下文中一共展示了Zend_Controller_Dispatcher_Interface::dispatch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action
/**
* Retrieve rendered contents of a controller action
*
* If the action results in a forward or redirect, returns empty string.
*
* @param string $action
* @param string $controller
* @param string $module Defaults to default module
* @param array $params
* @return string
*/
public function action($action, $controller, $module = null, array $params = array())
{
$this->resetObjects();
if (null === $module) {
$module = $this->defaultModule;
}
// clone the view object to prevent over-writing of view variables
$viewRendererObj = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
Zend_Controller_Action_HelperBroker::addHelper(clone $viewRendererObj);
$this->request->setParams($params)
->setModuleName($module)
->setControllerName($controller)
->setActionName($action)
->setDispatched(true);
$this->dispatcher->dispatch($this->request, $this->response);
// reset the viewRenderer object to it's original state
Zend_Controller_Action_HelperBroker::addHelper($viewRendererObj);
if (!$this->request->isDispatched()
|| $this->response->isRedirect())
{
// forwards and redirects render nothing
return '';
}
$return = $this->response->getBody();
$this->resetObjects();
return $return;
}