本文整理汇总了PHP中Cake\Controller\Controller::afterFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::afterFilter方法的具体用法?PHP Controller::afterFilter怎么用?PHP Controller::afterFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Controller\Controller
的用法示例。
在下文中一共展示了Controller::afterFilter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _outputMessage
/**
* Generate the response using the controller object.
*
* @param string $template The template to render.
* @return void
*/
protected function _outputMessage($template)
{
try {
$this->controller->render($template);
$event = new Event('Controller.shutdown', $this->controller);
$this->controller->afterFilter($event);
$this->controller->response->send();
} catch (MissingViewException $e) {
$attributes = $e->getAttributes();
if (isset($attributes['file']) && strpos($attributes['file'], 'error500') !== false) {
$this->_outputMessageSafe('error500');
} else {
$this->_outputMessage('error500');
}
} catch (\Exception $e) {
$this->_outputMessageSafe('error500');
}
}
示例2: _outputMessage
/**
* Generate the response using the controller object.
*
* @param string $template The template to render.
* @return \Cake\Network\Response A response object that can be sent.
*/
protected function _outputMessage($template)
{
try {
$this->controller->render($template);
$event = new Event('Controller.shutdown', $this->controller);
$this->controller->afterFilter($event);
return $this->controller->response;
} catch (MissingTemplateException $e) {
$attributes = $e->getAttributes();
if (isset($attributes['file']) && strpos($attributes['file'], 'error500') !== false) {
return $this->_outputMessageSafe('error500');
}
return $this->_outputMessage('error500');
} catch (MissingPluginException $e) {
$attributes = $e->getAttributes();
if (isset($attributes['plugin']) && $attributes['plugin'] === $this->controller->plugin) {
$this->controller->plugin = null;
}
return $this->_outputMessageSafe('error500');
} catch (\Exception $e) {
return $this->_outputMessageSafe('error500');
}
}