019-链接 使用name属性
路由设置:
(r'/', index.IndexHandler), tornado.web.url(r'/lj', index.LJHandler, {"word3":"ur","word4":"uurr"},
代码:
1 from tornado.web import RequestHandler 2 class IndexHandler(RequestHandler): 3 def get(self): 4 url=self.reverse_url("haola") 5 self.write("<a href='%s'> 去另一个界面吧</a>"%(url)) 6 7 class LJHandler(RequestHandler): 8 def initialize(self,word3,word4): 9 self.word3=word3 10 self.word4=word4 11 12 def get(self): 13 print(self.word3, self.word4) 14 self.write("URLLL")
效果:
===今日我言===========
勇气 让人进步
===================