From 1bee94cf43809dfed041db9be0e7443de018f3d4 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Fri, 21 Aug 2020 15:47:34 +0800 Subject: [PATCH] define error message --- platform/Normal.php | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/platform/Normal.php b/platform/Normal.php index 3505a62..fa1ab1f 100644 --- a/platform/Normal.php +++ b/platform/Normal.php @@ -112,7 +112,9 @@ function setConfig($arr, $disktag = '') //echo '
'. json_encode($envs, JSON_PRETTY_PRINT).''; $prestr = '0) return json_encode( [ 'response' => 'success' ] ); + return json_encode( [ 'message' => 'Failed to write config.', 'code' => 'failed' ] ); } function install() @@ -123,7 +125,7 @@ function install() $tmp['admin'] = $_POST['admin']; //$tmp['language'] = $_COOKIE['language']; $tmp['timezone'] = $_COOKIE['timezone']; - $response = setConfig($tmp); + $response = setConfigResponse( setConfig($tmp) ); if (api_error($response)) { $html = api_error_msg($response); $title = 'Error'; @@ -253,19 +255,19 @@ function RewriteEngineOn() function api_error($response) { - return !$response; + return isset($response['message']); } function api_error_msg($response) { - return $response . '