Commit 9df7088c by duwenjun

Merge branch 'feature/wenjun/20210425_env' into 'master'

可以在env中自定义资源和日志路径

See merge request !2
parents 5296b55c b0044b14
Showing with 9 additions and 2 deletions
<?php
use Dotenv\Loader;
/*
* 自定义全局变量
*/
......@@ -10,8 +12,13 @@ define('STATUS_ILLEGAL_PARAM',300); //操作被拒绝,可能是参数不合法
define('STATUS_ERROR',400); //列表的数据已被穷尽,没有更多数据
define('STATUS_UNKNOWN',500); //服务器未知错误
$EnvLoader = new Loader(dirname( $_SERVER['DOCUMENT_ROOT'] ) . '/.env');
$EnvLoader->load();
$RESOURCE_CONFIG_DIR = $EnvLoader->getEnvironmentVariable("RESOURCE_CONFIG_DIR");
$APP_STORAGE_PATH = $EnvLoader->getEnvironmentVariable("APP_STORAGE_PATH");
// 定义资源配置文件目录
define('RESOURCE_CONFIG_DIR' , '/data2/liexin_config');
define('RESOURCE_CONFIG_DIR' , ($RESOURCE_CONFIG_DIR) ? $RESOURCE_CONFIG_DIR : '/data2/liexin_config');
// 定义日志目录
define('APP_STORAGE_PATH' , '/data2/liexin_logs/frq_api');
define('APP_STORAGE_PATH' , ($APP_STORAGE_PATH) ? $APP_STORAGE_PATH : '/data2/liexin_logs/frq_api');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment