src/Request.php
public static function url()
    {

        $server = $_SERVER;

        $ssl = (!empty($server['HTTPS']) && $server['HTTPS'] == 'on');

        $sp = strtolower($server['SERVER_PROTOCOL']);

        $protocol = substr($sp, 0, strpos($sp, '/')) . (($ssl) ? 's' : '');

        $port = $server['SERVER_PORT'];

        $port = ((!$ssl && $port == '80') || ($ssl && $port == '443')) ? '' : ':' . $port;

        $host = isset($host) ? $host : $server['SERVER_NAME'] . $port;

        $host .= preg_replace("/\?.*/", "", $server["REQUEST_URI"]);

        return $protocol . '://' . $host;
    }
public static function url()
    {

        $server = $_SERVER;

        $ssl = (!empty($server['HTTPS']) && $server['HTTPS'] == 'on');

        $sp = strtolower($server['SERVER_PROTOCOL']);

        $protocol = substr($sp, 0, strpos($sp, '/')) . (($ssl) ? 's' : '');

        $port = $server['SERVER_PORT'];

        $port = ((!$ssl && $port == '80') || ($ssl && $port == '443')) ? '' : ':' . $port;

        $host = isset($host) ? $host : $server['SERVER_NAME'] . $port;

        $host .= preg_replace("/\?.*/", "", $server["REQUEST_URI"]);

        return $protocol . '://' . $host;
    }
public static function url ( ) { $ server = $ _SERVER ; $ ssl = ( ! empty ( $ server [ 'HTTPS' ] ) && $ server [ 'HTTPS' ] == 'on' ) ; $ sp = strtolower ( $ server [ 'SERVER_PROTOCOL' ] ) ; $ protocol = substr ( $ sp , 0 , strpos ( $ sp , '/' ) ) . ( ( $ ssl ) ? 's' : '' ) ; $ port = $ server [ 'SERVER_PORT' ] ; $ port = ( ( ! $ ssl && $ port == '80' ) || ( $ ssl && $ port == '443' ) ) ? '' : ':' . $ port ; $ host = isset ( $ host ) ? $ host : $ server [ 'SERVER_NAME' ] . $ port ; $ host .= preg_replace ( "/\?.*/" , "" , $ server [ "REQUEST_URI" ] ) ; return $ protocol . '://' . $ host ; }
Get the request url
@return string
Get the request url