本文整理汇总了PHP中Zend_Controller_Action::attach方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Action::attach方法的具体用法?PHP Zend_Controller_Action::attach怎么用?PHP Zend_Controller_Action::attach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Action
的用法示例。
在下文中一共展示了Zend_Controller_Action::attach方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _createController
/**
* Creates the controller and attaches observers to it
*
* @param Request $request
* @param string $className
*/
protected function _createController(Request $request, $className)
{
$template = new \Text_Template(__DIR__ . DIRECTORY_SEPARATOR . 'Spy' . DIRECTORY_SEPARATOR . 'Controller.php.dist');
$spyControllerName = 'SpyController' . rand(0, time());
$template->setVar(array('spyController' => $spyControllerName, 'userController' => $className));
eval($template->render());
$this->_currentController = new $spyControllerName($request, $this->getResponse(), $this->getParams());
foreach ($this->_observers as $observer) {
$this->_currentController->attach($observer);
}
if (!$this->_currentController instanceof ActionController) {
require_once 'Zend/Controller/Dispatcher/Exception.php';
throw new DispatcherException('Controller "' . $className . '" is not an instance of Zend_Controller_Action_Interface');
}
return $this->_currentController;
}