-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathY.php
More file actions
executable file
·90 lines (69 loc) · 2.89 KB
/
Y.php
File metadata and controls
executable file
·90 lines (69 loc) · 2.89 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
//项目开始时间
defined('BEGIN_TIME') or define('BEGIN_TIME',microtime(true));
define('Y_PATH',dirname(__FILE__).'/');
//!defined('ROOT') && exit('Forbidden');
//设置时区
date_default_timezone_set('Asia/Shanghai');
//设置错误等级
error_reporting(E_ALL);
//字符编码
header('Content-Type: text/html; charset=utf-8');
//加载常用的函数
require Y_PATH."common/common.func.php";
//加载常量
require Y_PATH."common/constant.php";
//定义目录常量
defined('LIB_PATH') or define('LIB_PATH',Y_PATH.'Lib/'); //系统核心类库目录
defined('APP_PATH') or define('APP_PATH',dirname($_SERVER['SCRIPT_FILENAME']).'/'); //项目路径
defined('APP_NAME') or define('APP_NAME',basename(dirname($_SERVER['SCRIPT_FILENAME'])));//项目名称
defined('MODEL_PATH') or define('MODEL_PATH',APP_PATH.'Model/'); //model
defined('VIEW_PATH') or define('VIEW_PATH',APP_PATH.'View/'); //view
defined('CONTROLLER_PATH') or define('CONTROLLER_PATH',APP_PATH.'Controller/'); //model
defined('RUNTIME_PATH') or define('RUNTIME_PATH',APP_PATH.'Runtime/'); //项目缓存目录
defined('CACHE_PATH') or define('CACHE_PATH',RUNTIME_PATH.'_cache/'); //项目模板缓存目录
defined('COMPILE_PATH') or define('COMPILE_PATH',RUNTIME_PATH.'_compile/'); //项目模板编译文件夹
defined('SESSION_PATH') or define('SESSION_PATH',RUNTIME_PATH.'_session/'); //项目模板编译文件夹
defined('CONF_PATH') or define('CONF_PATH',APP_PATH.'Conf/'); //项目配置目录
defined('LANG_PATH') or define('LANG_PATH',APP_PATH.'Lang/'); //项目语言包目录
defined('DRIVER_PATH') or define('DRIVER_PATH',Y_PATH.'Driver/'); //驱动目录
//ini_set( 'log_errors', 1 );
//ini_set( 'error_log', RUNTIME_PATH . '/error.log' );
//如果目录不存在则创建
if(!is_dir(CONTROLLER_PATH)) Fun::build_app_dir();
//加载惯例配置文件
C(include Y_PATH.'Conf/convention.php');
//加载框架语言文件
L(include Y_PATH.'Lang/'.strtolower(C('DEFAULT_LANG')).'.php');
//使用原始数据,入库需要转义!
if (!get_magic_quotes_gpc()) {
//trips
$_GET = Fun::addslashes_deep($_GET);
$_POST = Fun::addslashes_deep($_POST);
$_COOKIE = Fun::addslashes_deep($_COOKIE);
$_REQUEST = Fun::addslashes_deep($_REQUEST);
}
//session
Fun::session_start();
//exit;
//路由
$front = Front::getInstance();
$front->setControllerPath(CONTROLLER_PATH); //控制器目录
//注册运行的Module
$front->registerModules(C('FRONT_MODULES'));
try{
$front->dispatch();
}catch (Exception $e){
echo $e->getMessage();exit();
}
//自动加载类
function __autoload($class)
{
if(substr($class,-6) == 'Driver'){
$file = $class. '.class.php';
require_once(DRIVER_PATH . "Db/" . $file);
return;
}
$file = $class. '.class.php';
require_once(LIB_PATH . $file);
}