优雅的获取链接参数
def add2(request,a,b):
return HttpResponse(int(a)+int(b))
urlpatterns = [
url(r'^add/(\d+)/(\d+)/', add2),
]
# 访问localhost:8000/add/2/4/
返回6
def add2(request,a,b):
return HttpResponse(int(a)+int(b))
urlpatterns = [
url(r'^add/(\d+)/(\d+)/', add2),
]
# 访问localhost:8000/add/2/4/
返回6