• <i id='awx5r'><tr id='awx5r'><dt id='awx5r'><q id='awx5r'><span id='awx5r'><b id='awx5r'><form id='awx5r'><ins id='awx5r'></ins><ul id='awx5r'></ul><sub id='awx5r'></sub></form><legend id='awx5r'></legend><bdo id='awx5r'><pre id='awx5r'><center id='awx5r'></center></pre></bdo></b><th id='awx5r'></th></span></q></dt></tr></i><div id='awx5r'><tfoot id='awx5r'></tfoot><dl id='awx5r'><fieldset id='awx5r'></fieldset></dl></div>

  • <small id='awx5r'></small><noframes id='awx5r'>

      <bdo id='awx5r'></bdo><ul id='awx5r'></ul>
      <tfoot id='awx5r'></tfoot>

      1. <legend id='awx5r'><style id='awx5r'><dir id='awx5r'><q id='awx5r'></q></dir></style></legend>

        Zend Framework 如何设置标题

        时间:2023-10-02

          <bdo id='NPw7h'></bdo><ul id='NPw7h'></ul>
        • <small id='NPw7h'></small><noframes id='NPw7h'>

          <tfoot id='NPw7h'></tfoot>
          <legend id='NPw7h'><style id='NPw7h'><dir id='NPw7h'><q id='NPw7h'></q></dir></style></legend>

              <i id='NPw7h'><tr id='NPw7h'><dt id='NPw7h'><q id='NPw7h'><span id='NPw7h'><b id='NPw7h'><form id='NPw7h'><ins id='NPw7h'></ins><ul id='NPw7h'></ul><sub id='NPw7h'></sub></form><legend id='NPw7h'></legend><bdo id='NPw7h'><pre id='NPw7h'><center id='NPw7h'></center></pre></bdo></b><th id='NPw7h'></th></span></q></dt></tr></i><div id='NPw7h'><tfoot id='NPw7h'></tfoot><dl id='NPw7h'><fieldset id='NPw7h'></fieldset></dl></div>

                  <tbody id='NPw7h'></tbody>

                1. 本文介绍了Zend Framework 如何设置标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有一个问题,我该如何做这样的事情:

                  I have a question, how can I do something like this:

                  header("Content-Disposition: inline; filename=result.pdf"); 
                  header("Content-type: application/x-pdf"); 
                  

                  使用 Zend Framework,我已经尝试过:

                  With Zend Framework, I have tried:

                          $this->getResponse()
                          ->setHeader('Content-Disposition:inline', ' filename=result.pdf')
                          ->setHeader('Content-type', 'application/x-pdf');
                  

                  但不能正常工作.

                  推荐答案

                  您设置响应标头的语句有点格式错误:

                  Your statement to set the response headers is slightly malformed:

                  $this->getResponse()
                       ->setHeader('Content-Disposition', 'inline; filename=result.pdf')
                       ->setHeader('Content-type', 'application/x-pdf');
                  

                  以上应该可以工作 - 请注意 Content-Disposition-header 中的区别.

                  The above should work - please note the difference in the Content-Disposition-header.

                  顺便说一句...当您想强制下载框(而不是在浏览器中加载文档)时,您应该使用 Content-Disposition attachment.

                  By the way... When you want to force a download box (instead of loading the document in the browser) you should use the Content-Disposition attachment.

                  $this->getResponse()
                       ->setHeader('Content-Disposition', 'attachment; filename=result.pdf')
                       ->setHeader('Content-type', 'application/x-pdf');
                  

                  根据浏览器的不同,您可能还必须设置 Content-Length 或将 Content-type 更改为一个的组合(多个标题)或多个 application/force-downloadapplication/octet-stream 和/或 application/download.正如我在评论中所写,有时缓存标头可能会干扰您的下载.检查以查看发送了哪些缓存头.

                  Depending on the browser it may be possible that you also have to set the Content-Length or change the Content-type to a combination (multiple headers) of one or more of application/force-download, application/octet-stream and/or application/download. And as I wrote in the comment sometimes caching headers may interfere with your download. Check to see which caching-headers are sent.

                  这篇关于Zend Framework 如何设置标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何调试 MySQL/Doctrine2 查询? 下一篇:Zend Framework 1.11 与 Doctrine 2 集成

                  相关文章

                  最新文章

                  1. <small id='Reyoo'></small><noframes id='Reyoo'>

                  2. <tfoot id='Reyoo'></tfoot><legend id='Reyoo'><style id='Reyoo'><dir id='Reyoo'><q id='Reyoo'></q></dir></style></legend>

                    <i id='Reyoo'><tr id='Reyoo'><dt id='Reyoo'><q id='Reyoo'><span id='Reyoo'><b id='Reyoo'><form id='Reyoo'><ins id='Reyoo'></ins><ul id='Reyoo'></ul><sub id='Reyoo'></sub></form><legend id='Reyoo'></legend><bdo id='Reyoo'><pre id='Reyoo'><center id='Reyoo'></center></pre></bdo></b><th id='Reyoo'></th></span></q></dt></tr></i><div id='Reyoo'><tfoot id='Reyoo'></tfoot><dl id='Reyoo'><fieldset id='Reyoo'></fieldset></dl></div>
                      <bdo id='Reyoo'></bdo><ul id='Reyoo'></ul>