Пример #1
0
    //当前应用脚本的文件
}
$GLOBALS['url'] = REWRITE ? '/' . $_GET['m'] . '/' : $GLOBALS['app'] . $_GET['m'] . '/';
//当前的模块
define('H_ROOT', rtrim($GLOBALS['root'], '/'));
define('H_PUBLIC', rtrim($GLOBALS['public'], '/'));
define('H_RES', rtrim($GLOBALS['res'], '/'));
define('H_APP', rtrim($GLOBALS['app'], '/'));
define('H_URL', rtrim($GLOBALS['url'], '/'));
//访问的当前的控制器所在的路径文件
$srccontrolerfile = APP_PATH . 'controls/' . strtolower($_GET['m']) . '.class.php';
Debug::addmsg('当前访问的控制器类在项目应用下的:<b>' . $srccontrolerfile . '</b>文件!');
//控制器类的创建
if (file_exists($srccontrolerfile)) {
    Structure::commoncontroler(APP_PATH . 'controls/', $controlerpath);
    Structure::controler($srccontrolerfile, $controlerpath, $_GET['m']);
    $className = ucfirst($_GET['m']) . 'Action';
    $controler = new $className();
    $controler->run();
} else {
    if (DEBUG) {
        Debug::addmsg('<font color="red">对不起,访问的模块不存在,应该在' . APP_PATH . 'controls目录创建文件名为' . strtolower($_GET['m']) . '.class.php的文件,声明一个类名为' . ucfirst($_GET['m']) . '的类!</font>');
    } else {
        //Debug关闭时转换为404模式
        Action::_404();
    }
}
//输出Debug模式的信息
if (defined('DEBUG') && DEBUG == 1 && $GLOBALS['debug'] == 1) {
    Debug::stop();
    Debug::message();