-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
47 lines (33 loc) · 1022 Bytes
/
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
<?php
header('Content-Type:text/html;charset=utf-8');
date_default_timezone_set('PRC');
//定义常量
define('ROOT', __DIR__.'/'); //项目根路径
define('FILE_PATH', ROOT.'runtime/file/'); //缓存路径
define('TEMPLATE_PATH', ROOT.'template/'); //模板路径
define('CLASS_PATH', ROOT.'class/'); //模板路径
//错误配置
error_reporting(E_ALL);
ini_set('display_errors',1);
ini_set('error_log',ROOT.'/runtime/log/1.log');
//set_exception_handler('');
function exception_handler($exception) {
echo $exception->getMessage(), "\n";
}
set_exception_handler('exception_handler');
//包含公共文件和配置文件
require ROOT.'common.php';
require CLASS_PATH.'Main.php';
$db_config=require('config.php');
$config=[
'db'=>$db_config,
'file_path'=>FILE_PATH,
'template_path'=>TEMPLATE_PATH,
];
$main=new Main($config);
$act= isset($_GET['act'])? $_GET['act'] : 'index';
if(method_exists($main,$act)){
$main->$act();
}else{
exit('参数错误');
}