4
在我的控制器动作Content-Type的设置,我有这样的:的CakePHP忽略了响应
$pdf = $this->Invoice->makePdf($invoice);
$this->response->charset('UTF-8');
$this->response->body($pdf);
$this->response->type(array('pdf' => 'application/x-pdf'));
$this->response->disableCache();
$this->response->send();
但是,无论我做什么,总是CakePHP的发送数据作为text/html; charset=utf-8
。我也试过
$this->response->header(array('Content-Type' => 'application/x-pdf'));
但它仍然发送它为text/html
。我如何强制使用上面的内容类型发送回复?