<?php

function url_domain()
{
    $curr = strpos($_SERVER['PHP_SELF'], '/') !== false ?
            preg_replace('/(.*)()(\/?)(.)*/i', '\1', dirname($_SERVER['PHP_SELF'])) :
            dirname($_SERVER['PHP_SELF']);

    $root = str_replace('\\', '/', $curr);

    if (substr($root, -1) != '/')
    {
        $root .= '/';
    }

    return $root;
}
echo(url_domain());exit();
?>

 

相关文章:

  • 2022-12-23
  • 2022-03-02
  • 2021-11-27
  • 2021-07-06
  • 2022-12-23
  • 2022-02-15
  • 2021-09-07
  • 2021-08-31
猜你喜欢
  • 2021-11-12
  • 2022-12-23
  • 2022-12-23
  • 2021-07-22
  • 2021-07-21
  • 2022-12-23
相关资源
相似解决方案