标签:logs tar back second type settings odi opened lan
2017-7-8 15:45:30
#! bin/usr/evn python # -*- coding:utf-8 -*- import tornado.web import tornado.ioloop class Indexhandler(tornado.web.RequestHandler): def get(self): self.set_cookie(‘k1‘,‘999‘) ret = self.cookies print(ret) self.render(‘index.html‘) settings={ "template_path":‘views‘ } app=tornado.web.Application({ (r‘/index‘,Indexhandler), },**settings) if __name__==‘__main__‘: app.listen(‘8888‘) tornado.ioloop.IOLoop.instance().start()
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <div style="color: #c03945;">cookies</div> <script> function setCookie(name,value,expires){ var current_date = new Date(); current_date.setSeconds(current_date.getSeconds() + 5); document.cookie = name + "= "+ value +";expires=" + current_date.toUTCString(); } </script> </body> </html>
$.cookie(‘k1‘,‘666‘,{expires:7})
//这是保存七天的
var current_data=new Data();
current_data.setSeconds(current_data.getSeconds()+6)
$.cookie(‘k1‘,‘666‘,{expires:current_data})
// 这是保存6秒的
标签:logs tar back second type settings odi opened lan
原文地址:http://www.cnblogs.com/ezway/p/7137029.html