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

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

      如何检查标头是否已在 PHP 中发送

      How to check if Headers already been sent in PHP(如何检查标头是否已在 PHP 中发送)
      <tfoot id='FuB4Q'></tfoot>

              <tbody id='FuB4Q'></tbody>
          1. <small id='FuB4Q'></small><noframes id='FuB4Q'>

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

                本文介绍了如何检查标头是否已在 PHP 中发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我想我们大多数人都知道 PHP 中臭名昭著的标头已发送"错误.我可以检查一下是否已经发送了标头吗?

                I think most of us know about the infamous "Headers already sent" error in PHP. Can I check someway if headers already have been sent?

                在全力以赴尝试设置一些 SESSION 数据或类似数据之前,这样做真的很方便.

                It would be really handy to do such, before going all out with trying to set some SESSION data or similar.

                谢谢!

                推荐答案

                PHP有一个函数 headers_sent() 允许您在采取任何操作之前检查标头是否已发送出去.以下是在代码中使用该函数的方法:

                PHP has a function headers_sent() which allows you to check if the headers are already sent out before you take any action. Here’s how you could use the function in your code:

                if(headers_sent())
                { //if headers already sent out print some message.
                echo "Please go to yahoo.com";
                }
                else{
                //send the user automatically to test.php
                header('Location: http://yahoo.com');
                exit;
                }
                

                这篇关于如何检查标头是否已在 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 的问题)
                <i id='hzzYX'><tr id='hzzYX'><dt id='hzzYX'><q id='hzzYX'><span id='hzzYX'><b id='hzzYX'><form id='hzzYX'><ins id='hzzYX'></ins><ul id='hzzYX'></ul><sub id='hzzYX'></sub></form><legend id='hzzYX'></legend><bdo id='hzzYX'><pre id='hzzYX'><center id='hzzYX'></center></pre></bdo></b><th id='hzzYX'></th></span></q></dt></tr></i><div id='hzzYX'><tfoot id='hzzYX'></tfoot><dl id='hzzYX'><fieldset id='hzzYX'></fieldset></dl></div>

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

                      <bdo id='hzzYX'></bdo><ul id='hzzYX'></ul>
                    • <legend id='hzzYX'><style id='hzzYX'><dir id='hzzYX'><q id='hzzYX'></q></dir></style></legend>
                        <tbody id='hzzYX'></tbody>

                      • <tfoot id='hzzYX'></tfoot>