我需要通过控制器提供pdf文件,但我无法在浏览器窗口中打开它们.当我用pdf文件发送响应时,它会呈现乱码,或者如果我按照http://symfony.com/doc/current/components/http_foundation/introduction.html#serving-files中的示例,它会下载文件,但我需要在查看模式下打开它,我该怎么办?
这是我到目前为止所得到的:
return new Response(readfile('/file/path/file.pdf'), 200, array('Content-Type' => 'application/pdf') );
我错过了什么,或者我的php或apache配置有问题吗?