本文整理匯總了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');
}
}