1515use library \UsualToolData \UTData ;
1616use library \UsualToolDebug \UTDebug ;
1717/**
18- * 控制方向
18+ * 控制目录
1919 */
20- $ controlform ="admin " ;
20+ $ _form_ ="admin " ;
21+ /**
22+ * 模板目录
23+ */
24+ $ _temp_ ="admin " ;
2125/**
2226 * 获取版本号并载入应用部分设置
2327 */
6468 * 当前示例表示后端共用头部模板
6569 * 以下设置/admin表示后端,/front表示前端
6670 */
67- $ app ->Runin ("pubtemp " ,PUB_TEMP ."/ " .$ controlform );
71+ $ app ->Runin ("pubtemp " ,PUB_TEMP ."/ " .$ _temp_ );
6872/**
6973 * 写入模板工程后端公共路径
7074 */
71- $ app ->Runin ("template " ,$ adminwork ."/skin/ " .$ config ["DEFAULT_MOD " ]."/ " .$ controlform );
75+ $ app ->Runin ("template " ,$ adminwork ."/skin/ " .$ config ["DEFAULT_MOD " ]."/ " .$ _temp_ );
7276/**
7377 * 权限验证机制
7478 * 排除不需要验证的页面
8084 * 加载自定义权限文件
8185 * 该文件亦可封装为函数让autoload自动加载
8286 */
83- require PUB_PATH .'/ ' .$ controlform .'/session.php ' ;
87+ require PUB_PATH .'/ ' .$ _form_ .'/session.php ' ;
8488endif ;
8589/**
86- * 拼接当前文件
90+ * 路由分发控制
8791 */
88- $ modfile =$ modpath ."/ " .$ controlform ."/ " .$ p .".php " ;
92+ $ _map_ =$ modpath ."/route.php " ;
93+ $ _file_ =$ p ;
94+ if (UTInc::SearchFile ($ _map_ )):
95+ $ _route =include $ _map_ ;
96+ $ _file_ =$ _route [$ p ] ?? $ p ;
97+ endif ;
98+ $ _file_path_ =$ modpath ."/ " .$ _form_ ."/ " .$ _file_ .".php " ;
8999/**
90100 * 判断文件真实性
91101 */
92- if (UTInc::SearchFile ($ modfile )):
93- require_once $ modfile ;
94- $ classname =UTInc::GetClassName ($ modfile );
102+ if (UTInc::SearchFile ($ _file_path_ )):
103+ require_once $ _file_path_ ;
104+ $ _class_ =UTInc::GetClassName ($ _file_path_ );
95105 /**
96106 * 分层模式
97107 */
98- if ($ classname ):
108+ if ($ _class_ ):
99109 $ action =UTInc::SqlCheck ($ _GET ["action " ]) ?? "index " ;
100110 if (!preg_match ('/^[a-zA-Z0-9_]+$/ ' ,$ action )):
101111 $ action ="index " ;
102112 endif ;
103- $ controller =new $ classname ();
113+ $ controller =new $ _class_ ();
104114 /**
105115 * 执行动作
106116 */
109119 endif ;
110120 endif ;
111121else :
112- require_once PUB_PATH .'/front/error.php ' ;
113- exit ();
122+ UTDebug::Error ("module " ,str_replace (APP_ROOT ."/modules " ,"" ,$ modfile ));
114123endif ;
115124$ config ["DEBUG " ] && UTDebug::Debug ($ config ["DEBUG_BAR " ]);
0 commit comments