fix base path
continuous-integration/drone/push Build is passing Details

pull/3/head
maxime.batista 1 year ago
parent bdbceaa841
commit e7f5cc72c5

@ -8,14 +8,20 @@ use App\Controller\SampleFormController;
/** /**
* relative path of the index.php's directory from the server's document root. * relative path of the index.php's directory from the server's document root.
*/ */
global $basePath; function get_base_path() {
// find the server path of the index.php file // find the server path of the index.php file
$basePath = dirname(substr(__FILE__, strlen($_SERVER['DOCUMENT_ROOT']))); $basePath = dirname(substr(__FILE__, strlen($_SERVER['DOCUMENT_ROOT'])));
if ($basePath[strlen($basePath) - 1] == "/") { $c = $basePath[strlen($basePath) - 1];
$basePath = substr($basePath, 0, strlen($basePath) - 1);
if ($c == "/" || $c == "\\") {
$basePath = substr($basePath, 0, strlen($basePath) - 1);
}
return $basePath;
} }
$basePath = get_base_path();
// routes initialization // routes initialization
$router = new AltoRouter(); $router = new AltoRouter();
$router->setBasePath($basePath); $router->setBasePath($basePath);

Loading…
Cancel
Save