选择语言 :

 Bootstrap::_get_pathinfo

获取path_info

string Bootstrap::_get_pathinfo( )
返回值
  • string
File: ./core/bootstrap.php
private static function _get_pathinfo(& $url)
{
    $protocol = self::protocol();
    $protocol_len = strlen($protocol);

    $url = strtolower($url);

    # 结尾补/
    if (substr($url, -1) != '/') $url .= '/';

    if (substr($url, 0, $protocol_len) == $protocol)
    {
        $len = strlen($url);
        if ( strtolower(substr($_SERVER["SCRIPT_URI"], 0, $len)) == $url )
        {
            # 匹配到项目
            return '/' . substr($_SERVER["SCRIPT_URI"], $len);
        }
    }
    else
    {
        # 开头补/
        if (substr($url, 0, 1) != '/') $url = '/' . $url;
        $len = strlen($url);

        if (strtolower(substr(self::$path_info, 0, $len)) == $url)
        {
            # 匹配到项目
            return '/' . substr(self::$path_info, $len);
        }
    }

    return false;
}