This repository has been archived by the owner on May 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
admin.php
60 lines (53 loc) · 1.61 KB
/
admin.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
<?php
/**
* 入口。copy from index.php
*/
header("Content-Type:text/html;charset=utf-8");
if (PHP_VERSION < 5.3) {
//5.3+新特性:namespace、callStatic、__DIR__等
//exit('本程序需运行在PHP5.3+的环境上,当前的PHP版本为:' . PHP_VERSION);
}
define('IS_DEVELOP', true); // 是否处于开发模式
define("START_TIME", microtime()); // 用于计算页面耗时
define("ROOT_PATH", str_replace('\\', '/', dirname(__FILE__))); // 本程序根目录
//是否允许显示报错信息
if (IS_DEVELOP) {
error_reporting(E_ALL);
if (function_exists('ini_set')) {
ini_set('display_errors', 'On');
}
} else {
error_reporting(0);
if (function_exists('ini_set')) {
ini_set('display_errors', 'Off');
}
}
//加载Flight框架
require ROOT_PATH . "/libraries/Flight.php";
//自动加载这些路径下的类
function __autoload($class)
{
$class_dirs = array(
ROOT_PATH . "/libraries",
ROOT_PATH . "/controllers",
ROOT_PATH . "/controllers/front",
ROOT_PATH . "/controllers/backend",
ROOT_PATH . "/controllers/api",
ROOT_PATH . "/models"
);
$class_file = str_replace(array('\\', '_'), '/', $class) . '.php';
//含命名空间
foreach ($class_dirs as $dir) {
$file = $dir . '/' . $class_file;
if (file_exists($file)) {
/** @noinspection PhpIncludeInspection */
require $file;
break;
}
}
}
//保存一些全局变量
Flight::getInstance()->set(@include(ROOT_PATH . '/config.php'));
//启动框架
Flight::getInstance()->start(array("Helper", "initial"));
?>