ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
###**1. 建立用户表存储注册的用户** ###**2. 实现注册功能,当注册成功之后,把用户email插入邮件队列表中** ###**3. 使用ajax触发队列** ![](https://box.kancloud.cn/0703e54f4067d227d38d2f5a511d05d1_1312x645.png) ``` <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>用户注册</title> <!-- bootstrap文件需要自己下载引用 --> <link rel="stylesheet" type="text/css" href="./css/bootstrap.min.css" media="screen" title="no title" charset="utf-8"> <script src="./js/jquery-3.0.0.min.js" type="text/javascript" charset="utf-8"></script> <style media="screen"> body { padding:100px; } </style> <script type="text/javascript"> $.post('do_queue.php'); </script> </head> <body> <?php $link = mysql_connect("localhost", "root", "root"); mysql_select_db("muke"); mysql_query("set names utf-8"); if (isset($_POST['reg'])) { $userEmail = htmlspecialchars(trim($_POST['user_email']), ENT_QUOTES); $userPwd = htmlspecialchars(trim($_POST['user_password']), ENT_QUOTES); if (!empty($userEmail) && !empty($userPwd)) { $sql = "SELECT * FROM users WHERE user_email = ''"; $res = mysql_query($sql); if (mysql_fetch_row($res)) { echo "<script>alert('用户已经存在');</script>"; } else { $sql = "INSERT INTO users(user_email, user_password) VALUES('$userEmail', '$userPwd')"; $res = mysql_query($sql); if ($res !== false) { $sql = "INSERT INTO task_list(user_email, status, create_time, update_time) VALUES('$userEmail', 0, '" . date("Y-m-d H:i:s") . "', '" . date("Y-m-d H:i:s") . "')"; $res = mysql_query($sql); if($res !== false) { ?> <script type="text/javascript"> $.post('do_queue.php'); </script> <?php } } else { echo "<script>alert('用户注册失败');</script>"; } } } } ?> <div class="container"> <div class="row"> <form action="" method="post" class="form-horizontai"> <div class="form-group row"> <label class="control-label col-md-2 col-sm-2">用户Email:</label> <div class="col-md-4 col-sm-4"> <input type="text" name="user_email" value="" class="form-control"> </div> </div> <div class="form-group row"> <label class="control-label col-md-2 col-sm-2">密码:</label> <div class="col-md-4 col-sm-4"> <input type="text" name="user_password" value="" class="form-control"> </div> </div> <div class="form-group row"> <div class="col-md-4 col-md-offset-2 col-sm-offset-2"> <input type="submit" name="reg" value="注册" class="btn btn-primary"> </div> </div> </form> </div> </div> </body> </html> ```