UOJRequest::post('username'), 'password' => UOJRequest::post('password'), 'email' => UOJRequest::post('email') ]); } catch (UOJInvalidArgumentException $e) { return "失败:" . $e->getMessage(); } return "欢迎你!" . $user['username'] . ",你已成功注册。"; } if (isset($_POST['register'])) { echo handleRegisterPost(); unset($_SESSION['phrase']); die(); } elseif (isset($_POST['check_username'])) { $username = $_POST['username']; if (validateUsername($username) && !queryUser($username)) { die('{"ok": true}'); } else { die('{"ok": false}'); } } ?>