Http.php
public static function getUriString() : string
    {
        // Get request url and script url
        $url = '';
        $request_url = (isset($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : '';
        $script_url  = (isset($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : '';

        // Get our url path and trim the / of the left and the right
        if ($request_url != $script_url) {
            $url = trim(preg_replace('/'. str_replace('/', '\/', str_replace('index.php', '', $script_url)) .'/', '', $request_url, 1), '/');
        }

        $url = preg_replace('/\?.*/', '', $url); // Strip query string

        return $url;
    }
public static function getUriString() : string
    {
        // Get request url and script url
        $url = '';
        $request_url = (isset($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : '';
        $script_url  = (isset($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : '';

        // Get our url path and trim the / of the left and the right
        if ($request_url != $script_url) {
            $url = trim(preg_replace('/'. str_replace('/', '\/', str_replace('index.php', '', $script_url)) .'/', '', $request_url, 1), '/');
        }

        $url = preg_replace('/\?.*/', '', $url); // Strip query string

        return $url;
    }
public static function getUriString ( ) : string { // Get request url and script url $ url = '' ; $ request_url = ( isset ( $ _SERVER [ 'REQUEST_URI' ] ) ) ? $ _SERVER [ 'REQUEST_URI' ] : '' ; $ script_url = ( isset ( $ _SERVER [ 'PHP_SELF' ] ) ) ? $ _SERVER [ 'PHP_SELF' ] : '' ; // Get our url path and trim the / of the left and the right if ( $ request_url != $ script_url ) { $ url = trim ( preg_replace ( '/' . str_replace ( '/' , '\/' , str_replace ( 'index.php' , '' , $ script_url ) ) . '/' , '' , $ request_url , 1 ) , '/' ) ; } $ url = preg_replace ( '/\?.*/' , '' , $ url ) ; // Strip query string return $ url ; }
Get Uri String

$uri_string = Http::getUriString();

@access  public
@return string
Get Uri String