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

        <legend id='o9ale'><style id='o9ale'><dir id='o9ale'><q id='o9ale'></q></dir></style></legend>
      1. 在 php 中获取请求的 url 的 Content-Type

        Get Content-Type of requested url in php(在 php 中获取请求的 url 的 Content-Type)
        <legend id='2O1s7'><style id='2O1s7'><dir id='2O1s7'><q id='2O1s7'></q></dir></style></legend>

        <small id='2O1s7'></small><noframes id='2O1s7'>

            <tbody id='2O1s7'></tbody>

          1. <i id='2O1s7'><tr id='2O1s7'><dt id='2O1s7'><q id='2O1s7'><span id='2O1s7'><b id='2O1s7'><form id='2O1s7'><ins id='2O1s7'></ins><ul id='2O1s7'></ul><sub id='2O1s7'></sub></form><legend id='2O1s7'></legend><bdo id='2O1s7'><pre id='2O1s7'><center id='2O1s7'></center></pre></bdo></b><th id='2O1s7'></th></span></q></dt></tr></i><div id='2O1s7'><tfoot id='2O1s7'></tfoot><dl id='2O1s7'><fieldset id='2O1s7'></fieldset></dl></div>
              <bdo id='2O1s7'></bdo><ul id='2O1s7'></ul>
              <tfoot id='2O1s7'></tfoot>
                1. 本文介绍了在 php 中获取请求的 url 的 Content-Type的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  使用 php 如何将变量 $type 定义为 content-type" rel="nofollow">http://www.example.com

                  Using php how would I be able to define the variable $type into the content-type of http://www.example.com

                  例如:$type定义为"text/html"

                  到目前为止,这是我正在使用的:

                  So far this is what i am working with:

                  <?php
                  $url = 'http://www.example.com';
                  print_r(get_headers($url));
                  print_r(get_headers($url, 1));
                  ?>
                  

                  可以根据需要更改代码

                  推荐答案

                  你试过了吗:

                  $type = get_headers($url, 1)["Content-Type"];
                  

                  正如@Michael 在评论中指出的那样,如果没有最新版本的 PHP,这种语法将无法工作.

                  As noted in comments by @Michael, this syntax won't work without a very current version of PHP.

                  你也试过了吗:

                  $headers = get_headers($url, 1);
                  $type = $headers["Content-Type"];
                  

                  ?

                  这篇关于在 php 中获取请求的 url 的 Content-Type的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 中的按钮文本)
                  <i id='std2I'><tr id='std2I'><dt id='std2I'><q id='std2I'><span id='std2I'><b id='std2I'><form id='std2I'><ins id='std2I'></ins><ul id='std2I'></ul><sub id='std2I'></sub></form><legend id='std2I'></legend><bdo id='std2I'><pre id='std2I'><center id='std2I'></center></pre></bdo></b><th id='std2I'></th></span></q></dt></tr></i><div id='std2I'><tfoot id='std2I'></tfoot><dl id='std2I'><fieldset id='std2I'></fieldset></dl></div>
                  • <bdo id='std2I'></bdo><ul id='std2I'></ul>
                  • <tfoot id='std2I'></tfoot>

                        • <legend id='std2I'><style id='std2I'><dir id='std2I'><q id='std2I'></q></dir></style></legend>
                            <tbody id='std2I'></tbody>

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