时间:2021-07-01 10:21:17 帮助过:19人阅读
define('MODULE_NAME',self::getModule(C('VAR_MODULE')));
define('ACTION_NAME',self::getAction(C('VAR_ACTION')));
/**
+----------------------
* 获得实际的模块名称
+----------------------
* @access private
+----------------------
* @return string
+----------------------
*/
static private function getModule($var)
{
$module = (!empty($_GET[$var])? $_GET[$var]:C('DEFAULT_MODULE'));
if(C('URL_CASE_INSENSITIVE')) {
// URL地址不区分大小写
define('P_MODULE_NAME',strtolower($module));
// 智能识别方式 index.php/user_type/index/ 识别到 UserTypeAction 模块
$module = ucfirst(parse_name(P_MODULE_NAME,1));
}
unset($_GET[$var]);
return $module;
}
/**
+----------------------
* 获得实际的操作名称
+----------------------
* @access private
+----------------------
* @return string
+----------------------
*/
static private function getAction($var)
{
$action = !empty($_POST[$var]) ?
$_POST[$var] :
(!empty($_GET[$var])?$_GET[$var]:C('DEFAULT_ACTION'));
unset($_POST[$var],$_GET[$var]);
return C('URL_CASE_INSENSITIVE')?strtolower($action):$action;
}