Initial commit
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Here is your custom functions.
|
||||
*/
|
||||
|
||||
use support\exception\BusinessException;
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
*/
|
||||
function getConfig($filePath = null)
|
||||
{
|
||||
// 构建文件路径
|
||||
$config_file = app_path($filePath);
|
||||
// 检查文件是否存在
|
||||
if (!file_exists($config_file)) {
|
||||
return [];
|
||||
}
|
||||
// 包含文件并获取返回的数组
|
||||
$config = include $config_file;
|
||||
// 验证是否为数组
|
||||
if (!is_array($config)) {
|
||||
return [];
|
||||
}
|
||||
return $config;
|
||||
}
|
||||
Reference in New Issue
Block a user