* 解析访问URL */ $self = $_SERVER['PHP_SELF']; $self = trim($self, '/'); $self = preg_replace('/(.*\\/)?(index[0-9]?\\.php)/', '', $self); $self = trim($self, '/'); if ($self == '') { $self = array(); } else { $self = explode('/', $self); } switch (count($self)) { case 0: require_once Controller_Path . "/Application.php"; $obj = new Application(); $obj->welcome(); break; case 1: $class = $self[0]; //类名 $class = ucfirst($class); //首字母大写 if (!is_file(Controller_Path . $class . '.php')) { exit('类文件不存在'); } require_once Controller_Path . $class . '.php'; $obj = new $class(); if (method_exists($obj, 'index')) { $obj->index(); } else { printf("%s", '方法不存在');