From 8ab41c16bb202a4758667473e7e5b0653ed3a5a7 Mon Sep 17 00:00:00 2001 From: xcsoft Date: Tue, 13 Sep 2022 21:51:00 +0800 Subject: [PATCH] Update emailsend.php --- email/emailsend.php | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/email/emailsend.php b/email/emailsend.php index 8007a9e..9595dab 100644 --- a/email/emailsend.php +++ b/email/emailsend.php @@ -77,17 +77,13 @@ $mail->Subject = $topic; $mail->Body = $content; $mail->send(); - $data = array(//向服务器返回token - 'code' => '200' - ); - $data_json = json_encode($data); - header('Content-type:text/json'); - echo $data_json; + header('Content-type:text/json'); + echo json_encode(["code" => "200", "msg" => "success"]); } catch (Exception $e) { - $data = array(//向服务器返回token - 'code' => 'error' - ); - $data_json = json_encode($data); - header('Content-type:text/json'); - echo $data_json; -} \ No newline at end of file + $data = [ + 'code' => 'error' + ]; + if (DEBUG == true) $data["errMsg"] = $e->getMessage(); + header('Content-type:text/json'); + echo json_encode($data); +}