Skip to content

Commit 16977d7

Browse files
committed
update 260304
1 parent 635cd78 commit 16977d7

1 file changed

Lines changed: 26 additions & 10 deletions

File tree

open/dev/index.php

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
require dirname(__DIR__).'/'.'config.php';
1414
use library\UsualToolInc\UTInc;
1515
use library\UsualToolData\UTData;
16+
use library\UsualToolDebug\UTDebug;
17+
/**
18+
* 控制方向
19+
*/
20+
$controlform="admin";
1621
/**
1722
* 获取版本号并载入应用部分设置
1823
*/
@@ -59,11 +64,11 @@
5964
* 当前示例表示后端共用头部模板
6065
* 以下设置/admin表示后端,/front表示前端
6166
*/
62-
$app->Runin("pubtemp",PUB_TEMP."/admin");
67+
$app->Runin("pubtemp",PUB_TEMP."/".$controlform);
6368
/**
6469
* 写入模板工程后端公共路径
6570
*/
66-
$app->Runin("template",$adminwork."/skin/".$config["DEFAULT_MOD"]."/admin");
71+
$app->Runin("template",$adminwork."/skin/".$config["DEFAULT_MOD"]."/".$controlform);
6772
/**
6873
* 权限验证机制
6974
* 排除不需要验证的页面
@@ -75,24 +80,35 @@
7580
* 加载自定义权限文件
7681
* 该文件亦可封装为函数让autoload自动加载
7782
*/
78-
require PUB_PATH.'/admin/session.php';
83+
require PUB_PATH.'/'.$controlform.'/session.php';
7984
endif;
8085
/**
8186
* 拼接当前文件
8287
*/
83-
$modfile=$modpath."/admin/".$p.".php";
88+
$modfile=$modpath."/".$controlform."/".$p.".php";
8489
/**
8590
* 判断文件真实性
8691
*/
87-
if(library\UsualToolInc\UTInc::SearchFile($modfile)):
88-
/**
89-
* 引用后端模板
90-
*/
92+
if(UTInc::SearchFile($modfile)):
9193
require_once $modfile;
92-
else:
94+
$classname=UTInc::GetClassName($modfile);
9395
/**
94-
* 配置公共错误提示
96+
* 分层模式
9597
*/
98+
if($classname):
99+
$action=UTInc::SqlCheck($_GET["action"]) ?? "index";
100+
if(!preg_match('/^[a-zA-Z0-9_]+$/',$action)):
101+
$action="index";
102+
endif;
103+
$controller=new $classname();
104+
/**
105+
* 执行动作
106+
*/
107+
if(method_exists($controller,$action) || method_exists($controller,'__call')):
108+
$controller->$action();
109+
endif;
110+
endif;
111+
else:
96112
require_once PUB_PATH.'/front/error.php';
97113
exit();
98114
endif;

0 commit comments

Comments
 (0)