【发布时间】:2011-09-11 02:58:46
【问题描述】:
我已阅读线程output image in a Kohana 3.2 view,但代码在我的计算机上不起作用。
我编写了一个将图像输出到浏览器的操作 (如果我把超类改成Controller,还是不行。),代码是这样的:
class Controller_Portal extends Controller_Template {
public function action_view() {
$filename = "E:\workspace\myphoto.jpg";
$this->response->headers('Content-Type', File::mime($filename))
->send_headers() // If I remove this line, It still doesn't work
->body(file_get_contents($filename));
exit;
}
}
【问题讨论】: