本文整理汇总了PHP中Magento\Framework\App\Response\Http::setHttpResponseCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::setHttpResponseCode方法的具体用法?PHP Http::setHttpResponseCode怎么用?PHP Http::setHttpResponseCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\App\Response\Http
的用法示例。
在下文中一共展示了Http::setHttpResponseCode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleDeveloperMode
/**
* Error handler for developer mode
*
* @param Bootstrap $bootstrap
* @param \Exception $exception
* @return bool
*/
private function handleDeveloperMode(Bootstrap $bootstrap, \Exception $exception)
{
if ($bootstrap->isDeveloperMode()) {
$this->_response->setHttpResponseCode(500);
$this->_response->setHeader('Content-Type', 'text/plain');
$this->_response->setBody($exception->getMessage() . "\n" . $exception->getTraceAsString());
$this->_response->sendResponse();
return true;
}
return false;
}
示例2: handleDeveloperMode
/**
* Error handler for developer mode
*
* @param Bootstrap $bootstrap
* @param \Exception $exception
* @return bool
*/
private function handleDeveloperMode(Bootstrap $bootstrap, \Exception $exception)
{
if ($bootstrap->isDeveloperMode()) {
if (Bootstrap::ERR_IS_INSTALLED == $bootstrap->getErrorCode()) {
try {
$this->redirectToSetup($bootstrap, $exception);
return true;
} catch (\Exception $e) {
$exception = $e;
}
}
$this->_response->setHttpResponseCode(500);
$this->_response->setHeader('Content-Type', 'text/plain');
$this->_response->setBody($this->buildContentFromException($exception));
$this->_response->sendResponse();
return true;
}
return false;
}
示例3: processReport
/**
* Process report
*
* @return \Magento\Framework\App\Response\Http
*/
public function processReport()
{
$this->pageTitle = 'There has been an error processing your request';
$this->_response->setHttpResponseCode(503);
$this->showErrorMsg = false;
$this->showSentMsg = false;
$this->showSendForm = false;
$this->reportAction = $this->_config->action;
$this->_setReportUrl();
if ($this->reportAction == 'email') {
$this->showSendForm = true;
$this->sendReport();
}
$this->_response->setBody($this->_renderPage('report.phtml'));
return $this->_response;
}
示例4: setHttpResponseCode
/**
* {@inheritdoc}
*/
public function setHttpResponseCode($code)
{
$pluginInfo = $this->pluginList->getNext($this->subjectType, 'setHttpResponseCode');
if (!$pluginInfo) {
return parent::setHttpResponseCode($code);
} else {
return $this->___callPlugins('setHttpResponseCode', func_get_args(), $pluginInfo);
}
}