$this->autoRender = false;
$this->response->header("HTTP/1.1 200 OK");
$this->response->header("Pragma: public");
$this->response->header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
$this->response->header("Cache-Control: private", false);
//$this->response->header("Content-type: image/png"); //tried also
$this->response->type('jpg');
$this->response->body(readfile($file));
return $this->response;
始终返回Content-Type:text / html;字符集= UTF-8。
由于
答案 0 :(得分:0)
$this->response->body(readfile($file));
将此行更改为
$this->response->body(file_get_contents($file));
并且有效。
我知道它是更高性能的readfile,但此刻,应该可以工作。
可能是readfile因enconding而中断的内容。