contentType, 'charset') === false) { $this->contentType .= '; charset=' . $response->charset; } $response->getHeaders()->set('Content-Type', $this->contentType); if ($response->data !== null) { $tmplContent = $response->data; // 去除html空格与换行 $find = array("~>\s+<~","~>(\s+\n|\r)~"); $replace = array('><','>'); $tmplContent = preg_replace($find, $replace, $tmplContent); $response->content = $tmplContent; } }}