From 5489238259ef6e793ca5425053d5b1d29280ce1b Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Sun, 5 Jan 2020 10:27:37 +0800 Subject: [PATCH] Update functions.php --- functions.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/functions.php b/functions.php index 23a5064..0230000 100644 --- a/functions.php +++ b/functions.php @@ -448,9 +448,10 @@ function time_format($ISO) function getConfig($str) { - $s = file_get_contents('config.json'); - if ($s!='') { - $envs = json_decode($s, true); + include 'config.php'; + //$s = file_get_contents('config.json'); + if ($configs!='') { + $envs = json_decode($configs, true); if (isset($envs[$str])) return $envs[$str]; } return ''; @@ -491,14 +492,19 @@ function array_value_isnot_null($arr) function setConfig($arr) { - $envs = json_decode(file_get_contents('config.json'), true); + include 'config.php'; + if ($configs!='') $envs = json_decode($configs, true); foreach ($arr as $k1 => $v1) { $envs[$k1] = $v1; } $envs = array_filter($envs, 'array_value_isnot_null'); ksort($envs); //echo '
'. json_encode($envs, JSON_PRETTY_PRINT).''; - return file_put_contents('config.json', json_encode($envs, JSON_PRETTY_PRINT)); + $prestr = '