标签:UI openresty roo capture server body render local http
luarocks install lua-resty-template
location /{
root html;
content_by_lua ‘
local template = require "resty.template"
template.render("view.html",{ message ="Hello, World!"})
‘;
}
<!DOCTYPE html>
<html>
<body>
<h1>{{message}}</h1>
</body>
</html>
http {
server {
set $template_root /usr/local/openresty/nginx/html/templates;
location /{
root html;
content_by_lua ‘
local template = require "resty.template"
template.render("view.html",{ message ="Hello, World!"})
‘;
}
}
}
http {
server {
set $template_location /templates;
location /{
root html;
content_by_lua ‘
local template = require "resty.template"
template.render("view.html",{ message ="Hello, World!"})
‘;
}
location /templates {
internal;
alias html/templates/;
}
}
https://github.com/bungle/lua-resty-template
lua resty template && openresty 使用
标签:UI openresty roo capture server body render local http
原文地址:http://www.cnblogs.com/rongfengliang/p/6666598.html