会话的保持和form表单

会话的保持和form表单


cookie

  • 设置cookie
     from django.shortcuts import render, HttpResponse, redirect, reverse
    
     def set_cookie(request):
         num = request.COOKIES.get('num', 0)
         num = str(int(num) + 1)
         response = render(request, 'crm/count.html', context={
             'num': num
         })
         response.set_cookie('num', num, max_age=5)
         return response

    设置超时间为5秒

session

  •  
上一篇:oracle用户被锁定


下一篇:【Android】Android内存机制,了解Android堆和栈