<legend id='31QwB'><style id='31QwB'><dir id='31QwB'><q id='31QwB'></q></dir></style></legend>

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

      2. <tfoot id='31QwB'></tfoot>

        <small id='31QwB'></small><noframes id='31QwB'>

          <bdo id='31QwB'></bdo><ul id='31QwB'></ul>

        Zend Framework 如何设置标题

        时间:2023-05-30
        <legend id='GTKbW'><style id='GTKbW'><dir id='GTKbW'><q id='GTKbW'></q></dir></style></legend>
      3. <i id='GTKbW'><tr id='GTKbW'><dt id='GTKbW'><q id='GTKbW'><span id='GTKbW'><b id='GTKbW'><form id='GTKbW'><ins id='GTKbW'></ins><ul id='GTKbW'></ul><sub id='GTKbW'></sub></form><legend id='GTKbW'></legend><bdo id='GTKbW'><pre id='GTKbW'><center id='GTKbW'></center></pre></bdo></b><th id='GTKbW'></th></span></q></dt></tr></i><div id='GTKbW'><tfoot id='GTKbW'></tfoot><dl id='GTKbW'><fieldset id='GTKbW'></fieldset></dl></div>
          <tbody id='GTKbW'></tbody>
        <tfoot id='GTKbW'></tfoot>

            • <bdo id='GTKbW'></bdo><ul id='GTKbW'></ul>

                <small id='GTKbW'></small><noframes id='GTKbW'>

                  本文介绍了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 如何设置标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文章

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

                      <small id='NqTLe'></small><noframes id='NqTLe'>

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