Request::getScriptName PHP Method

getScriptName() public static method

Returns current script name.
public static getScriptName ( ) : string
return string
        public static function getScriptName()
        {
            //Method inherited from \Symfony\Component\HttpFoundation\Request
            return \Illuminate\Http\Request::getScriptName();
        }

Usage Example

 function getCurrentUrl()
 {
     $toUse = Request::getScriptName();
     $return = substr($toUse, 1 - strlen($toUse) + strrpos($toUse, "/"));
     if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
         $return .= "?" . $_SERVER['QUERY_STRING'];
     }
     // not '//' in url
     if ($return == '/') {
         $return = '';
     } else {
         // case servers that give path/page for return instead of page only! too bad
         if (ereg('/', $return)) {
             $return = substr($return, strrpos($return, "/") + 1);
         }
     }
     //print($return);
     //exit;
     return $return;
 }