$basepath = implode('/', array_slice(explode('/', $_SERVER['SCRIPT_NAME']), 0, -1)) . '/'; $uri = substr($_SERVER['REQUEST_URI'], strlen($basepath)); if (strstr($uri, '?')) $uri = substr($uri, 0, strpos($uri, '?')); $url = trim($uri, '/');
In PHP 7, the decision made gives me the error that only variables are allowed, so this works for me.
niravpatel9898
source share