Update functions.php

pull/13/head
qkqpttgf 2020-01-01 14:26:27 +08:00 committed by GitHub
parent 7748863b0e
commit 30c9e23e38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -434,13 +434,14 @@ function array_value_isnot_null($arr)
function setConfig($arr) function setConfig($arr)
{ {
echo '<pre>'. json_encode($arr, JSON_PRETTY_PRINT).'</pre>'; //echo '<pre>'. json_encode($arr, JSON_PRETTY_PRINT).'</pre>';
$envs = json_decode(file_get_contents('config.json')); $envs = json_decode(file_get_contents('config.json'));
if ($envs=='') $envs = []; if ($envs=='') $envs = [];
foreach ($arr as $k1 => $v1) { foreach ($arr as $k1 => $v1) {
$evns[$k1] = $v1; echo $k1 . '=' . $v1 .'<br>';
$envs[$k1] = $v1;
} }
echo '<pre>'. json_encode($envs, JSON_PRETTY_PRINT).'</pre>'; //echo '<pre>'. json_encode($envs, JSON_PRETTY_PRINT).'</pre>';
$envs = array_filter($envs, 'array_value_isnot_null'); $envs = array_filter($envs, 'array_value_isnot_null');
ksort($envs); ksort($envs);
echo '<pre>'. json_encode($envs, JSON_PRETTY_PRINT).'</pre>'; echo '<pre>'. json_encode($envs, JSON_PRETTY_PRINT).'</pre>';