Blues框架如何取得请求者的Rquest信息

Blues框架如何取得请求者的Rquest信息

在request.lua下引用nginx.lua这个lazytable库。

local params = require "nginx"

function Request:getInstance()

        local name = "request"
        local instance = { 
                        url="/request",
                        getName = function()
                                lp("CRequest!")
                        end 
                        }   

        instance.uri = "candy lab"
        instance.params = params
        setmetatable(instance, { __index = self,
                                 __call = function()
                                                lp("Initial Instance")
                                        end 
                                 })  
        return instance
end

app.lua

app:get("/blues", function(request,id)
    for k,v in pairs(request.params) do
        ngx.say(k)
    end 
    return {k='key', v='value'}
end)

糖果

糖果
LUA从入门到放弃

Moonscript如何显示复选框

Moonscript如何显示复选框 Continue reading

Lapis框架的常用处理方法

Published on March 02, 2017