<tfoot id='jYTPe'></tfoot>

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

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

      1. <legend id='jYTPe'><style id='jYTPe'><dir id='jYTPe'><q id='jYTPe'></q></dir></style></legend>

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

        如果找到子域,则从 url 字符串中删除子域

        Delete subdomain from url string if subdomain is found(如果找到子域,则从 url 字符串中删除子域)
          <bdo id='zJRPS'></bdo><ul id='zJRPS'></ul>

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

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

              <legend id='zJRPS'><style id='zJRPS'><dir id='zJRPS'><q id='zJRPS'></q></dir></style></legend>
                <tbody id='zJRPS'></tbody>

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

                  本文介绍了如果找到子域,则从 url 字符串中删除子域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个这样的域数组:

                  I have an array of domains like this:

                  domain.com
                  second.com
                  www.third.com
                  www.fourth.fifth.com
                  sixth.com
                  seventh.eigth.com
                  

                  我想要的是一个只返回主机的函数.没有子域.

                  what I want is a function to return me the host only. Without subdomain.

                  这段代码是我到目前为止获取主机名的代码:

                  This code is what i have so far for getting the hostname:

                  $parse = parse_url($url);
                  $domain = $parse['host'];
                  

                  但这仅返回:

                  domain.com
                  second.com
                  third.com
                  fourth.fifth.com
                  sixth.com
                  seventh.eigth.com
                  

                  不过我需要这个输出:

                  domain.com
                  second.com
                  third.com
                  fifth.com
                  sixth.com
                  eigth.com
                  

                  推荐答案

                  function giveHost($host_with_subdomain) {
                      $array = explode(".", $host_with_subdomain);
                  
                      return (array_key_exists(count($array) - 2, $array) ? $array[count($array) - 2] : "").".".$array[count($array) - 1];
                  }
                  

                  这篇关于如果找到子域,则从 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 的问题)
                  • <bdo id='MYIOU'></bdo><ul id='MYIOU'></ul>

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

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

                            <tbody id='MYIOU'></tbody>