当前位置: 首页>>代码示例>>PHP>>正文


PHP Http::setHttpResponseCode方法代码示例

本文整理汇总了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;
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:18,代码来源:Http.php

示例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;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:26,代码来源:Http.php

示例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;
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:21,代码来源:processor.php

示例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);
     }
 }
开发者ID:HaonanXu,项目名称:der-snack-backup,代码行数:12,代码来源:Interceptor.php


注:本文中的Magento\Framework\App\Response\Http::setHttpResponseCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。