mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 23:02:48 +08:00
简化mvc类的命名
This commit is contained in:
@@ -212,11 +212,11 @@ class App {
|
|||||||
// URL后缀
|
// URL后缀
|
||||||
define('__EXT__', strtolower(pathinfo($_SERVER['PATH_INFO'],PATHINFO_EXTENSION)));
|
define('__EXT__', strtolower(pathinfo($_SERVER['PATH_INFO'],PATHINFO_EXTENSION)));
|
||||||
$_SERVER['PATH_INFO'] = __INFO__;
|
$_SERVER['PATH_INFO'] = __INFO__;
|
||||||
if(!defined('BIND_MODULE')){
|
if(__INFO__ && !defined('BIND_MODULE')){
|
||||||
if($config['url_deny_suffix'] && preg_match('/\.('.$config['url_deny_suffix'].')$/i', $_SERVER['PATH_INFO'])){
|
if($config['url_deny_suffix'] && preg_match('/\.('.$config['url_deny_suffix'].')$/i', __INFO__)){
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$paths = explode($config['pathinfo_depr'], $_SERVER['PATH_INFO']);
|
$paths = explode($config['pathinfo_depr'], __INFO__,2);
|
||||||
// 获取URL中的模块名
|
// 获取URL中的模块名
|
||||||
if($config['require_module'] && !isset($_GET[$config['var_module']])) {
|
if($config['require_module'] && !isset($_GET[$config['var_module']])) {
|
||||||
$_GET[$config['var_module']] = array_shift($paths);
|
$_GET[$config['var_module']] = array_shift($paths);
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ class Loader {
|
|||||||
$path = APP_PATH;
|
$path = APP_PATH;
|
||||||
}
|
}
|
||||||
$filename = $path . str_replace('\\', '/', str_replace('\\_','\\',strtolower(trim(preg_replace("/[A-Z]/", "_\\0", $class), "_")))) . EXT;
|
$filename = $path . str_replace('\\', '/', str_replace('\\_','\\',strtolower(trim(preg_replace("/[A-Z]/", "_\\0", $class), "_")))) . EXT;
|
||||||
var_dump($filename);
|
|
||||||
if(is_file($filename)) {
|
if(is_file($filename)) {
|
||||||
include $filename;
|
include $filename;
|
||||||
}
|
}
|
||||||
@@ -138,8 +137,7 @@ class Loader {
|
|||||||
}else{
|
}else{
|
||||||
$module = MODULE_NAME;
|
$module = MODULE_NAME;
|
||||||
}
|
}
|
||||||
$layer = ucwords($layer);
|
$class = $module . '\\' . $layer . '\\' . parse_name($name, 1);
|
||||||
$class = $module . '\\' . $layer . '\\' . parse_name($name, 1). $layer;
|
|
||||||
if(class_exists($class)) {
|
if(class_exists($class)) {
|
||||||
$model = new $class($name);
|
$model = new $class($name);
|
||||||
}else {
|
}else {
|
||||||
@@ -166,14 +164,13 @@ class Loader {
|
|||||||
}else{
|
}else{
|
||||||
$module = MODULE_NAME;
|
$module = MODULE_NAME;
|
||||||
}
|
}
|
||||||
$layer = ucwords($layer);
|
$class = $module . '\\' . $layer . '\\' . parse_name($name, 1) ;
|
||||||
$class = $module . '\\' . $layer . '\\' . parse_name($name, 1) . $layer;
|
|
||||||
if(class_exists($class)) {
|
if(class_exists($class)) {
|
||||||
$action = new $class;
|
$action = new $class;
|
||||||
$_instance[$name . $layer] = $action;
|
$_instance[$name . $layer] = $action;
|
||||||
return $action;
|
return $action;
|
||||||
}elseif(class_exists($module . '\\' . $layer . '\\Empty' . $layer)){
|
}elseif(class_exists($module . '\\' . $layer . '\\Empty')){
|
||||||
$class = $module . '\\' . $layer . '\\Empty' . $layer;
|
$class = $module . '\\' . $layer . '\\Empty';
|
||||||
return new $class;
|
return new $class;
|
||||||
}else{
|
}else{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user