-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
63 lines (40 loc) · 1.37 KB
/
index.php
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
ini_set('display_errors','On');
ini_set('memory_limit', '2048M');
# === Session
session_cache_limiter(false);
@session_start();
#get the url base
function getBaseUrl()
{
// output: /myproject/index.php
$currentPath = $_SERVER['PHP_SELF'];
// output: Array ( [dirname] => /myproject [basename] => index.php [extension] => php [filename] => index )
$pathInfo = pathinfo($currentPath);
// output: localhost
$hostName = $_SERVER['HTTP_HOST'];
// output: http://
$protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"],0,5))=='https://'?'https://':'http://';
// return: http://localhost/myproject/
return $protocol.$hostName.$pathInfo['dirname']."/";
}
//colocando o caminho para o projeto, server path
$urlBase = getBaseUrl();
define("_BASEURL", $urlBase);
require 'vendor/autoload.php';
$app = new \Slim\Slim(array(
'debug' => true
));
require_once __DIR__ . '/bootstrap.php';
# === helpers
# ==================================================
require_once __DIR__ . '/helpers/appHelpers.php';
# === models
# ==================================================
require_once __DIR__ . "/models/appModels.php";
# === controllers
# ==================================================
require_once __DIR__ . "/controllers/appControllers.php";
$app->run ();
?>