###
下面这段代码可以参考http://www.tornadoweb.org/en/stable/,这个是tornado宽框架
import tornado.ioloop import tornado.web class MainHandler(tornado.web.RequestHandler): def get(self): print('get111') u = self.get_argument('user') p = self.get_argument('pwd') if u == 'lws' and p =='lws123': self.write("welcome") else: self.write('滚') def post(self): u = self.get_argument('user') p = self.get_argument('pwd') print(u,p) self.write("POST") def make_app(): return tornado.web.Application([ (r"/", MainHandler), ]) if __name__ == "__main__": app = make_app() app.listen(8888) tornado.ioloop.IOLoop.current().start()
###
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>表单标签</title> </head> <body> <!-- 默认是以get方式提交 请求头+body(内容)//get内容都在url然而post放在body GET:拼接URL http://localhost:8889/?user=lws&pwd=lws123 POST:http://localhost:8889 --> <form action="http://localhost:8888/" method="get"> <input type="text" name="user" placeholder="user" > <input type="password" name="pwd" placeholder="pwd"> <input type="submit" value="submit"> </form> </body> </html>
###