mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 07:32:48 +08:00
取消URL参数常量
This commit is contained in:
3
base.php
3
base.php
@@ -29,9 +29,6 @@ defined('EXT') or define('EXT', '.php');
|
|||||||
defined('MODEL_LAYER') or define('MODEL_LAYER', 'model');
|
defined('MODEL_LAYER') or define('MODEL_LAYER', 'model');
|
||||||
defined('VIEW_LAYER') or define('VIEW_LAYER', 'view');
|
defined('VIEW_LAYER') or define('VIEW_LAYER', 'view');
|
||||||
defined('CONTROLLER_LAYER') or define('CONTROLLER_LAYER', 'controller');
|
defined('CONTROLLER_LAYER') or define('CONTROLLER_LAYER', 'controller');
|
||||||
defined('VAR_MODULE') or define('VAR_MODULE', 'm');
|
|
||||||
defined('VAR_CONTROLLER') or define('VAR_CONTROLLER', 'c');
|
|
||||||
defined('VAR_ACTION') or define('VAR_ACTION', 'a');
|
|
||||||
defined('APP_DEBUG') or define('APP_DEBUG', false); // 是否调试模式
|
defined('APP_DEBUG') or define('APP_DEBUG', false); // 是否调试模式
|
||||||
defined('ENV_PREFIX') or define('ENV_PREFIX', 'T_'); // 环境变量的配置前缀
|
defined('ENV_PREFIX') or define('ENV_PREFIX', 'T_'); // 环境变量的配置前缀
|
||||||
defined('IS_API') or define('IS_API', false); // 是否API接口
|
defined('IS_API') or define('IS_API', false); // 是否API接口
|
||||||
|
|||||||
@@ -44,11 +44,11 @@ class App
|
|||||||
// 自动化创建脚本
|
// 自动化创建脚本
|
||||||
Create::build(include APP_PATH . 'build.php');
|
Create::build(include APP_PATH . 'build.php');
|
||||||
}
|
}
|
||||||
// 监听app_init
|
|
||||||
Hook::listen('app_init');
|
|
||||||
|
|
||||||
// 初始化公共模块
|
// 初始化公共模块
|
||||||
self::initModule(APP_PATH . $config['common_module'] . '/', $config);
|
self::initModule(APP_PATH . $config['common_module'] . '/', $config);
|
||||||
|
// 监听app_init
|
||||||
|
Hook::listen('app_init');
|
||||||
|
|
||||||
// 启动session
|
// 启动session
|
||||||
if ($config['use_session']) {
|
if ($config['use_session']) {
|
||||||
@@ -239,7 +239,7 @@ class App
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = [];
|
$result = [null, null, null];
|
||||||
if (empty($_SERVER['PATH_INFO'])) {
|
if (empty($_SERVER['PATH_INFO'])) {
|
||||||
$_SERVER['PATH_INFO'] = '';
|
$_SERVER['PATH_INFO'] = '';
|
||||||
define('__INFO__', '');
|
define('__INFO__', '');
|
||||||
@@ -276,7 +276,7 @@ class App
|
|||||||
$_SERVER['PATH_INFO'] = preg_replace($config['url_html_suffix'] ? '/\.(' . trim($config['url_html_suffix'], '.') . ')$/i' : '/\.' . __EXT__ . '$/i', '', $_SERVER['PATH_INFO']);
|
$_SERVER['PATH_INFO'] = preg_replace($config['url_html_suffix'] ? '/\.(' . trim($config['url_html_suffix'], '.') . ')$/i' : '/\.' . __EXT__ . '$/i', '', $_SERVER['PATH_INFO']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$module = strtolower($result[0] ? $result[0] : $config['default_module']);
|
$module = strtolower($result[0] ?: $config['default_module']);
|
||||||
if ($maps = $config['url_module_map']) {
|
if ($maps = $config['url_module_map']) {
|
||||||
if (isset($maps[$module])) {
|
if (isset($maps[$module])) {
|
||||||
// 记录当前别名
|
// 记录当前别名
|
||||||
@@ -304,30 +304,10 @@ class App
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取控制器名
|
// 获取控制器名
|
||||||
define('CONTROLLER_NAME', strip_tags(strtolower($result[1] ? $result[1] : $config['default_controller'])));
|
define('CONTROLLER_NAME', strip_tags(strtolower($result[1] ?: $config['default_controller'])));
|
||||||
|
|
||||||
// 获取操作名
|
// 获取操作名
|
||||||
define('ACTION_NAME', strip_tags(strtolower($result[2] ? $result[2] : $config['default_action'])));
|
define('ACTION_NAME', strip_tags(strtolower($result[2] ?: $config['default_action'])));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $config
|
|
||||||
*/
|
|
||||||
private static function getModule($config)
|
|
||||||
{
|
|
||||||
$module = strtolower(isset($_GET[VAR_MODULE]) ? $_GET[VAR_MODULE] : $config['default_module']);
|
|
||||||
if ($maps = $config['url_module_map']) {
|
|
||||||
if (isset($maps[$module])) {
|
|
||||||
// 记录当前别名
|
|
||||||
define('MODULE_ALIAS', $module);
|
|
||||||
// 获取实际的项目名
|
|
||||||
$module = $maps[MODULE_ALIAS];
|
|
||||||
} elseif (array_search($module, $maps)) {
|
|
||||||
// 禁止访问原始项目
|
|
||||||
$module = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return strip_tags($module);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ class Route
|
|||||||
public static function parseUrl($url)
|
public static function parseUrl($url)
|
||||||
{
|
{
|
||||||
if ('/' == $url) {
|
if ('/' == $url) {
|
||||||
return;
|
return [null, null, null];
|
||||||
}
|
}
|
||||||
$paths = explode('/', $url);
|
$paths = explode('/', $url);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user