|
123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
-
-
- namespace yii\web;
-
- use yii\base\Component;
-
-
- class HtmlResponseFormatter extends Component implements ResponseFormatterInterface
- {
-
-
- public $contentType = 'text/html';
-
-
-
-
- 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;
- }
- }
- }
|