首页 > 其他 > 详细

用lua 对cookie的控制

时间:2015-06-07 11:14:13      阅读:4552      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!