-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
28 lines (21 loc) · 791 Bytes
/
index.php
File metadata and controls
28 lines (21 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
require __DIR__ . "/inc/bootstrap.php";
if (!file_exists("number.sqlite")) {require_once PROJECT_ROOT_PATH . "/inc/bulidDatabase.php";}
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$uri = explode( '/', $uri );
if ((isset($uri[2]) && $uri[2] != 'numbers') || !isset($uri[3])) {
header("Location: http://localhost:8080/404.php");
exit();
}
require PROJECT_ROOT_PATH . "/Controller/Api/NumberController.php";
$requestMethod = $_SERVER["REQUEST_METHOD"];
$objFeedController = new NumberController();
try{
$strMethodName = $uri[3] . 'Action';
if ($uri[3] == "post" && $requestMethod == "POST") :
$objFeedController->post();
endif;
$objFeedController->{$strMethodName}();
}catch( Exception $e) {
}
?>