实现后台及前台通过API访问UV埋点,所有代码全部保存
This commit is contained in:
60
docs/common/const.md
Normal file
60
docs/common/const.md
Normal file
@@ -0,0 +1,60 @@
|
||||
# 常量的定义
|
||||
|
||||
src\app\event\init\InitConfig.php
|
||||
|
||||
```
|
||||
/**
|
||||
* 初始化常量
|
||||
*/
|
||||
private function initConst()
|
||||
{
|
||||
//加载版本信息
|
||||
define('SHOP_MODULE', 'shop');
|
||||
defined('SYS_VERSION_NO') or define('SYS_VERSION_NO', Config::get('info.version')); //版本号
|
||||
defined('SYS_VERSION_NAME') or define('SYS_VERSION_NAME', Config::get('info.title')); //版本名称
|
||||
defined('SYS_VERSION') or define('SYS_VERSION', Config::get('info.name')); //版本类型
|
||||
defined('SYS_RELEASE') or define('SYS_RELEASE', Config::get('info.version_no')); //版本号
|
||||
//是否展示帮助快捷链接
|
||||
define('HELP_SHOW', 1);
|
||||
//加载基础化配置信息
|
||||
define('__ROOT__', str_replace([ '/index.php', '/install.php' ], '', request()->root(true)));
|
||||
|
||||
define('__PUBLIC__', __ROOT__ . '/public');
|
||||
define('__UPLOAD__', 'upload');
|
||||
|
||||
//插件目录名称
|
||||
define('ADDON_DIR_NAME', 'addon');
|
||||
//插件目录路径
|
||||
define('ADDON_PATH', 'addon/');
|
||||
//分页每页数量
|
||||
define('PAGE_LIST_ROWS', 10);
|
||||
|
||||
define('MEMBER_LEVEL', 10);
|
||||
|
||||
//伪静态模式是否开启
|
||||
define('REWRITE_MODULE', true);
|
||||
|
||||
// public目录绝对路径
|
||||
define('PUBLIC_PATH', root_path() . '/public/');
|
||||
// 项目绝对路径
|
||||
define('ROOT_PATH', root_path());
|
||||
|
||||
//兼容模式访问
|
||||
if (!REWRITE_MODULE) {
|
||||
define('ROOT_URL', request()->root(true) . '/?s=');
|
||||
} else {
|
||||
define('ROOT_URL', request()->root(true));
|
||||
}
|
||||
|
||||
//检测网址访问
|
||||
$url = request()->url(true);
|
||||
$url = strtolower($url);
|
||||
if (strstr($url, 'call_user_func_array') || strstr($url, 'invokefunction') || strstr($url, 'think\view')) {
|
||||
die("非法请求");
|
||||
}
|
||||
|
||||
// 应用模块
|
||||
$GLOBALS[ 'system_array' ] = [ 'shop', 'install', 'cron', 'api', 'pay', 'public', 'app', 'index', SHOP_MODULE ];
|
||||
$GLOBALS[ 'app_array' ] = [ 'shop', 'store' ];
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user