• <small id='8BjTu'></small><noframes id='8BjTu'>

        <bdo id='8BjTu'></bdo><ul id='8BjTu'></ul>

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

        了解 PHP 的 header()

        To understand PHP#39;s header()(了解 PHP 的 header())

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

          <legend id='0wQBY'><style id='0wQBY'><dir id='0wQBY'><q id='0wQBY'></q></dir></style></legend>
            <bdo id='0wQBY'></bdo><ul id='0wQBY'></ul>
                  <tbody id='0wQBY'></tbody>
                <tfoot id='0wQBY'></tfoot>

                1. 本文介绍了了解 PHP 的 header()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  你在哪里使用命令 header()?

                  我在 handlers/handle_login.php 中有以下代码.用户从 index.php 进入站点,这是起始位置.

                  I have the following code at handlers/handle_login.php. The user has gone to the site from index.php which is the starting place.

                   if(!$logged_in){
                       header("Location: index.php");                                                                          
                       die("You are not logged_in");
                   }
                  

                  如果 if-clause 为真,我会收到 404 错误,因为标题将我转到 handlers/index.php,而不是 index.php.

                  If if-clause is true, I get a 404 error, since the header puts me to to handlers/index.php, instead of index.php.

                  推荐答案

                  虽然我同意尼拉莫和伯爵的观点,但我希望我能给出更大的图景:

                  While I agree with nilamo and earl, I hope I can give a bigger picture:

                  使用相对路径可能会产生非常奇怪的效果,具体取决于浏览器的位置认为"它在您的站点层次结构中.例如,假设站点有一个索引文件/index.php",但配置为接受 URI 路径中的模块和操作.您可能有一个如下所示的网址:

                  Using relative paths can have very strange effects depending on where the browser 'thinks' it is in your site hierarchy. For example, assume the site has an index file '/index.php' but is configured to accept module and action in the URI path. You may very well have a url that looks like:

                  http://www.yoursite.com/forms/contact/
                  

                  从这种情况下,返回一个像这样的标题:

                  From this situation, returning a header like:

                  header("Location: index.php");
                  

                  很可能会导致浏览器尝试请求

                  may very well cause the browser to try to request

                  http://www.yoursite.com/forms/contact/index.php
                  

                  这显然不是你想要的.出于这个原因,通常最好使用上面推荐的/index.php",或者尽可能使用完全限定的 URL.

                  which is obviously not what you want. For this reason, it's generally better to use '/index.php' as recommended above, or even better use the fully qualified URL when possible.

                  希望这会有所帮助.

                  这篇关于了解 PHP 的 header()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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='15bf5'></tfoot>
                  1. <legend id='15bf5'><style id='15bf5'><dir id='15bf5'><q id='15bf5'></q></dir></style></legend>

                    <small id='15bf5'></small><noframes id='15bf5'>

                          • <bdo id='15bf5'></bdo><ul id='15bf5'></ul>
                              <tbody id='15bf5'></tbody>

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