コード例 #1
0
 /**
  * Formats the specified response.
  * @param \yii\web\Response $response the response to be formatted.
  */
 public function format($response)
 {
     parent::format($response);
     if (!is_string($response->content)) {
         $response->content = "<PRE>" . var_export($response->content, true) . "</PRE>";
     }
 }
コード例 #2
0
ファイル: MyHtmlResponseFormatter.php プロジェクト: gtyd/jira
 /**
  * 兼容前端_STATIC_,_WEB_语法替换
  * @param Response $response the response to be formatted.
  */
 public function format($response)
 {
     //         if (stripos($this->contentType, 'charset') === false) {
     //             $this->contentType .= '; charset=' . $response->charset;
     //         }
     //         $response->getHeaders()->set('Content-Type', $this->contentType);
     //         if ($response->data !== null) {
     //             $response->content = $response->data;
     //         }
     parent::format($response);
     if (is_string($response->content)) {
         $static_host = isset(\Yii::$app->params['static_host']) ? \Yii::$app->params['static_host'] : '';
         //$response->content = str_replace('_STATIC_', \mysoft\pubservice\Conf::getConfig('static_site'), $response->content);
         $response->content = str_replace('_WEB_', $static_host . \Yii::getAlias('@web'), $response->content);
     }
 }