<bdo id='oeQRF'></bdo><ul id='oeQRF'></ul>
    1. <small id='oeQRF'></small><noframes id='oeQRF'>

      1. <tfoot id='oeQRF'></tfoot>

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

        PHP REGEX:从 URL 获取域

        PHP REGEX: Get domain from URL(PHP REGEX:从 URL 获取域)
            <legend id='gv6uJ'><style id='gv6uJ'><dir id='gv6uJ'><q id='gv6uJ'></q></dir></style></legend><tfoot id='gv6uJ'></tfoot>

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

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

                  <tbody id='gv6uJ'></tbody>

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

                  问题描述

                  我想要的

                  我想从 URL 获取 domain 部分,所以从 http://example.com/ -> example.com

                  I want to get from a URL the domain part so from http://example.com/ -> example.com

                  示例:

                  +----------------------------------------------+-----------------------+
                  | input                                        | output                |
                  +----------------------------------------------+-----------------------+
                  | http://www.stackoverflow.com/questions/ask   | www.stackoverflow.com |
                  | http://validator.w3.org/check                | validator.w3.org      |
                  | http://www.google.com/?q=hello               | www.google.com        |
                  | http://google.de/?q=hello                    | google.de             |
                  +----------------------------------------------+-----------------------+
                  

                  我在 stackoverflow 中发现了一些相关的问题,但没有一个是我想要的.

                  I found some related questions in stackoverflow but none of them was exactly what I was looking for.

                  感谢您的帮助!

                  推荐答案

                  没有必要为此使用正则表达式.PHP 有一个内置函数可以做到这一点.使用 parse_url():

                  There's no need to use a regex for this. PHP has an inbuilt function to do just this. Use parse_url():

                  $domain = parse_url($url, PHP_URL_HOST);
                  

                  这篇关于PHP REGEX:从 URL 获取域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的问题)
                  • <legend id='pe2is'><style id='pe2is'><dir id='pe2is'><q id='pe2is'></q></dir></style></legend>

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

                          <tbody id='pe2is'></tbody>

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