<tfoot id='aHeSV'></tfoot>

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

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

      <legend id='aHeSV'><style id='aHeSV'><dir id='aHeSV'><q id='aHeSV'></q></dir></style></legend>

      1. 面试问题:我们可以在标题之前有一个回声吗?

        Interview Question: Can we have an echo before header?(面试问题:我们可以在标题之前有一个回声吗?)
      2. <legend id='NsbaF'><style id='NsbaF'><dir id='NsbaF'><q id='NsbaF'></q></dir></style></legend>

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

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

                    <tbody id='NsbaF'></tbody>
                  本文介绍了面试问题:我们可以在标题之前有一个回声吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我参加了 php 测试,他们问了一个我找不到答案的问题.

                  I appeared for php test, their I was asked one question for which I could not find the answer.

                  问题是这样的.

                  echo "MESSI is injured!!";
                  header("Location:somepage.php");
                  

                  面试官希望 headerecho 写在同一页面上.

                  Interviewer want both header and echo to be written on the same page.

                  我想知道这怎么可能.它应该给出一些错误,例如

                  I wonder how's it possible.It should give some error like

                  已发送的标头(输出开始于.....

                  真的可以将echo和header写到同一个页面吗!!!

                  Is it really possible to write echo and header onto same page !!!

                  推荐答案

                  你可以使用 输出缓冲 as

                  ob_start();
                  echo "MESSI is injured!!";
                  header("Location:somepage.php");
                  ob_end_flush();
                  

                  问题是我们开始发送输出后无法发送标头.为了解决这个问题,我们缓冲输出.ob_start 函数打开输出缓冲.当输出缓冲处于活动状态时,不会从脚本发送输出(除了标题),而是将输出存储在内部缓冲区中.所以 echo 输出将被缓冲.接下来我们发送标题没有任何问题,因为我们还没有吐出任何输出.最后我们调用 ob_end_flush 来刷新内部缓冲区内容并停止输出缓冲.

                  The problem is that we cannot send the header after we start sending the output. To solve this we buffer the output. The function ob_start turns output buffering on. While output buffering is active no output is sent from the script (other than headers), instead the output is stored in an internal buffer. So the echo output will be buffered. Next we send the header without any problem as we've not yet spit out any output. Finally we call ob_end_flush to flush the internal buffer contents and to stop output buffering.

                  这篇关于面试问题:我们可以在标题之前有一个回声吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  PHP Upload File Validation(PHP 上传文件验证)
                  PHP Error - Uploading a file(PHP 错误 - 上传文件)
                  How can I write tests for file upload in PHP?(如何在 PHP 中编写文件上传测试?)
                  php resizing image on upload rotates the image when i don#39;t want it to(php在上传时调整图像大小会在我不想要它时旋转图像)
                  How to send additional data using PLupload?(如何使用 PLupload 发送附加数据?)
                  change button text in js/ajax after mp4 =gt;mp3 conversion in php(在 php 中的 mp4 =gt;mp3 转换后更改 js/ajax 中的按钮文本)
                • <tfoot id='UejDG'></tfoot>
                  <legend id='UejDG'><style id='UejDG'><dir id='UejDG'><q id='UejDG'></q></dir></style></legend>

                      <bdo id='UejDG'></bdo><ul id='UejDG'></ul>
                        <tbody id='UejDG'></tbody>

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

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