-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBootstrap.php
50 lines (34 loc) · 1008 Bytes
/
Bootstrap.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
<?php
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
class Bootstrap {
//定义一个run方法
public static function Run(){
self::init();
}
private static function init(){
// 定义PATH
define('ROOT', __DIR__);
define('APP_PATH', ROOT . '/App/');
//自动加载
require_once 'vendor/autoload.php';
//加载路由
require_once 'App/Routes.php';
//错误提示
$whoops = new \Whoops\Run;
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
$whoops->register();
// cache
if (!is_dir(ROOT.'/Storage/Cache/')) {
mkdir(ROOT.'/Storage/Cache/', 0700);
}
/**
* 初始化日志系统
*/
$log = new Logger('name');
$log->pushHandler(new StreamHandler(ROOT.'/Storage/Logs/', Logger::WARNING));
}
};
//use App\Home\Controllers\HomeController;
//$home = new HomeController();
//$home->index();