多个匹配,范围大的要放在后面
URL的三种映射方式
url映射的三种方式
url映射,请求处理,相应处理
import web urls = ( '/index','index', '/blog/\d+','blog', '/.(.*)','hello', ) app = web.application(urls, globals()) class index: #def GET(self): # return 'index method' def GET(self): return open(r'html5.html','r').read() class blog: def GET(self): return 'blog method' def POST(self): return 'blog post method' class hello: def GET(self,name): return 'hello ' + name if __name__ == "__main__": app.run() #http://localhost:8080/blog/76675667 #http://localhost:8080/index #http://localhost:8080/hello
URL映射
url 匹配从上到下
范围应该要从小到大的
URL映射
URL映射