Allow configure SITE_URL with or without slash at end.
This commit is contained in:
parent
a10308a8f6
commit
b85fb7e034
@ -83,7 +83,7 @@ class Router {
|
||||
public static function basePath(): string
|
||||
{
|
||||
if (defined('SITE_URL') && !empty(SITE_URL))
|
||||
return parse_url(SITE_URL, PHP_URL_PATH);
|
||||
return rtrim(parse_url(SITE_URL, PHP_URL_PATH), '/').'/';
|
||||
return str_replace($_SERVER['DOCUMENT_ROOT'], '/', ROOT_DIR);
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ class View extends Neuron {
|
||||
public function route(string $path = '/'): string
|
||||
{
|
||||
if (defined('SITE_URL') && !empty(SITE_URL))
|
||||
return SITE_URL.ltrim($path, '/');
|
||||
return rtrim(SITE_URL, '/').'/'.ltrim($path, '/');
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user