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

    <tfoot id='S8s2b'></tfoot><legend id='S8s2b'><style id='S8s2b'><dir id='S8s2b'><q id='S8s2b'></q></dir></style></legend>
      • <bdo id='S8s2b'></bdo><ul id='S8s2b'></ul>

        标头如何与 PHP 中的输出缓冲一起使用?

        How do headers work with output buffering in PHP?(标头如何与 PHP 中的输出缓冲一起使用?)
          <tbody id='dpVyB'></tbody>

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

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

              <bdo id='dpVyB'></bdo><ul id='dpVyB'></ul>

              <tfoot id='dpVyB'></tfoot>

                  <legend id='dpVyB'><style id='dpVyB'><dir id='dpVyB'><q id='dpVyB'></q></dir></style></legend>
                  本文介绍了标头如何与 PHP 中的输出缓冲一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  标题不言自明.

                  我对 PHP 有一些经验,但我不确定 header 函数在 ob_start()ob_end_clean() 之间是如何工作的代码>.

                  I have a good bit of experience with PHP, but I am not sure how the header function works between ob_start() and ob_end_clean().

                  考虑一下:

                  ob_start();
                  
                  echo "Some content";
                  header('X-Example-Header: foo');
                  echo "Some more content";
                  
                  $output = ob_get_contents();
                  ob_end_clean();
                  
                  echo $output;
                  

                  header 函数是否会忽略输出缓冲,因此所有标头都会在内容之前发送,因为它是在 header 之后 echoed打电话?

                  Does the header function ignore the output buffering, and thus all headers get sent before the content because it is echoed after the header call?

                  还是以其他方式起作用?

                  Or does it work some other way?

                  推荐答案

                  header() 确实忽略了输出缓冲.使用输出缓冲的部分原因是您可以乱序"发送 HTTP 标头,因为响应已被缓冲.一旦发送了任何类型的输出(除非该输出被缓冲),就不能发送 HTTP 标头.

                  The header() does indeed ignore output buffering. Part of the reason to use output buffering is so you can send HTTP headers "out of order" since the response is buffered. You can't send HTTP headers once you've sent any kind of output (unless that output is buffered).

                  这篇关于标头如何与 PHP 中的输出缓冲一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  <tfoot id='DVgPk'></tfoot>

                      <bdo id='DVgPk'></bdo><ul id='DVgPk'></ul>

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

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

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