以上代码解释
- IndexController:index (index Controller 中的 index Action),通过
self:getView()
方法获取视图实例 - 模板参数都是与 LUA 数组的形式进行传递
- 每个 action 的返回值都必须是字符串,所以可以知道
view:display()
和view:render()
方法都是返回字符串 - IndexController:action_b (index Controller 中的 action_b Action,这里注意,action 的方法名必须小写),使用默认的简单路由协议,访问 URI 为
curl http://localhost:9110/index/action_b
新添加一个 Controller
local IdevzController = {}
function IdevzController:dohello()
return 'do-hello-action.'
end
return IdevzController