forked from biehege/cheng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
67 lines (51 loc) · 1.52 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
64
65
66
67
<?php
/**
* @file index
* @author ryan <cumt.xiaochi@gmail.com>
* @created Jun 30, 2012 10:38:22 AM
* app logic
* 此框架由王霄池纯粹手写而成,当然参照了不少鸡爷的框架,也参照了 LazyPHP
*/
// 打开错误提示, SAE 可以 ini_set 将不起作用
ini_set('display_errors', 1);
error_reporting(E_ALL);
define('IN_PTF', 1);
define('APP_ROOT', __DIR__ . DIRECTORY_SEPARATOR);
require 'config/common.php';
// if not debug, mute all error reportings
if (!(defined('DEBUG') ? DEBUG : 0)) {
ini_set('display_errors', 0);
error_reporting(0);
}
require 'lib/function.php';
include 'lib/autoload.php';
// 变量初始化
require 'init.php';
init_var();
ob_start();
session_start();
date_default_timezone_set('PRC');
require 'lib/helper.php';
require FrameFile::controller('init');
if (isset($force_redirect)) { // 强制跳转 这个在整站关闭的时候很有用
$controller = $force_redirect;
}
$view = $controller;
if (!file_exists(FrameFile::controller($controller))) {
$controller = 'default'; // page 404
include FrameFile::controller($controller);
include smart_view($controller);
exit;
}
// auto include if there exists css or js file same name with controller
if (file_exists(_css($controller)))
$page['styles'][] = $controller;
// execute controller
include FrameFile::controller($controller);
// view
$arr = explode('?', $view);
if (count($arr) == 2 && $arr[1] == 'master') {
$content = $arr[0];
$view = 'master';
}
include smart_view($view); // 渲染 view