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.
*/
global $basePath;
// find the server path of the index.php file
$basePath = dirname(substr(__FILE__, strlen($_SERVER['DOCUMENT_ROOT'])));
function get_base_path() {
// find the server path of the index.php file
$basePath = dirname(substr(__FILE__, strlen($_SERVER['DOCUMENT_ROOT'])));
if ($basePath[strlen($basePath) - 1] == "/") {
$basePath = substr($basePath, 0, strlen($basePath) - 1);
$c = $basePath[strlen($basePath) - 1];
if ($c == "/" || $c == "\\") {
$basePath = substr($basePath, 0, strlen($basePath) - 1);
}
return $basePath;
}
$basePath = get_base_path();
// routes initialization
$router = new AltoRouter();
$router->setBasePath($basePath);

Loading…
Cancel
Save