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

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

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

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

        什么时候可以未定义 HTTP Host 标头?

        When could the HTTP Host header be undefined?(什么时候可以未定义 HTTP Host 标头?)

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

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

                  <bdo id='PBvNh'></bdo><ul id='PBvNh'></ul>
                • 本文介绍了什么时候可以未定义 HTTP Host 标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  根据定义 HTTP/1.1 的 RFC 2616,Host: 标头是必需的.

                  According to RFC 2616, which defines HTTP/1.1, the Host: header is mandatory.

                  客户端必须在所有 HTTP/1.1 请求消息中包含 Host 标头字段.

                  A client MUST include a Host header field in all HTTP/1.1 request messages .

                  但 PHP 手册 暗示它可能是空的:

                  But the PHP manual implies that it could be empty:

                  'HTTP_HOST':Host 的内容:当前请求的标头,如果有的话.

                  'HTTP_HOST': Contents of the Host: header from the current request, if there is one.

                  在哪些情况下,这个标头以及 $_SERVER['HTTP_HOST'] 可能为空?我的应用程序能否依赖于它的存在?

                  In which situations could this header, and thus $_SERVER['HTTP_HOST'], be empty? Could my application depend on its being there?

                  推荐答案

                  在 HTTP 1.0 中可以为空.如果没有指定主机头,虚拟主机将根本无法工作,因此将使用 Web 服务器中的默认虚拟主机.

                  It can be empty in HTTP 1.0. If no host header is specified, virtual hosting won't work at all, so the default vhost in your web server will be used.

                  我自己测试过这个;在 Nginx 下的 PHP 中,$_SERVER['HTTP_HOST'] 变量被设置为虚拟主机的名称,在我的例子中是 _.但这也取决于你在 Nginx 中的 fastcgi_params 配置.

                  I just tested this myself; in PHP under Nginx the $_SERVER['HTTP_HOST'] variable got set to the name of the virtual host, which is _ in my case. But that also depends on your fastcgi_params configuration in Nginx.

                  在共享主机上这并不重要,因为默认虚拟主机将设置为托管公司的某些信息页面,因此您的脚本将不会运行.不过,对于您自己的服务器来说,记住这一点可能是件好事.

                  On shared hosting this is not important since the default vhost will be set to some information page from the hosting company, and so your script will not be run. Could be a good thing to keep in mind for your own server though.

                  这篇关于什么时候可以未定义 HTTP Host 标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的问题)
                  smtp gmail server php mailer not working(smtp gmail服务器php邮件程序不工作)
                  Email goes in spam when I send it via others SMTP server(当我通过其他 SMTP 服务器发送电子邮件时,电子邮件进入垃圾邮件)
                  <legend id='NgTaF'><style id='NgTaF'><dir id='NgTaF'><q id='NgTaF'></q></dir></style></legend>

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

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

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