码迷,mamicode.com
首页 > 其他好文 > 详细

用lua 对cookie的控制

时间:2015-06-07 11:15:25      阅读:2717      评论:0      收藏:0      [点我收藏+]

标签:

header_filter_by_lua ‘

        t = {}

        if ngx.var.http_cookie then

            s = ngx.var.http_cookie

            for k, v in string.gmatch(s, "(%w+)=([%w%/%.=_-]+)") do

                t[k] = v

            end

        end

                                                      

        p = ngx.req.get_uri_args()

                                                      

        if not t.uid and p.uid then

            expires = ngx.cookie_time(4523969511)

            ngx.header["Set-Cookie"] = {"uid=" .. p.uid .."; expires=" .. expires .. ";

        end

                                                      

‘;


用lua 对cookie的控制

标签:

原文地址:http://my.oschina.net/epiclight/blog/425898

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!