$GLOBALS['app'] = $_SERVER['SCRIPT_NAME'] . '/'; //当前应用脚本的文件 } $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();
$GLOBALS["public"] = $GLOBALS["root"] . 'public/'; //项目的全局资源目录 $GLOBALS["res"] = rtrim(dirname($_SERVER["SCRIPT_NAME"]), "/\\") . '/' . ltrim(APP_PATH, './') . "views/" . TPLSTYLE . "/resource/"; //当前应用模板的资源 $GLOBALS["app"] = $_SERVER["SCRIPT_NAME"] . '/'; //当前应用脚本文件 $GLOBALS["url"] = $GLOBALS["app"] . $_GET["m"] . '/'; //访问到当前模块 define("B_ROOT", rtrim($GLOBALS["root"], '/')); define("B_PUBLIC", rtrim($GLOBALS["public"], '/')); define("B_APP", rtrim($GLOBALS["app"], '/')); define("B_URL", rtrim($GLOBALS["url"], '/')); define("B_RES", rtrim($GLOBALS["res"], '/')); //控制器类所在的路径 $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 { Debug::addmsg("<font color='red'>对不起!你访问的模块不存在,应该在" . APP_PATH . "controls目录下创建文件名为" . strtolower($_GET["m"]) . ".class.php的文件,声明一个类名为" . ucfirst($_GET["m"]) . "的类!</font>"); } //设置输出Debug模式的信息 if (defined("DEBUG") && DEBUG == 1 && $GLOBALS["debug"] == 1) { Debug::stop(); Debug::message(); }