主页 > 知识库 > 基于 aLi Lua Web Server 的一个简单例子

基于 aLi Lua Web Server 的一个简单例子

热门标签:网站排名优化 百度竞价排名 地方门户网站 呼叫中心市场需求 AI电销 Linux服务器 铁路电话系统 服务外包

复制代码 代码如下:

file = 'index.lua'
if headers.uri ~= '/' then file = headers.uri end
 
local fexists = file_exists(file)
 
if not fexists then
    -- try stat file.lua
    fexists = file_exists(file .. '.lua')
    if fexists then
        file = file .. '.lua'
    end
end
 
if fexists then
    if file:find('.css') or file:find('.js') or file:find('font') or file:find('.ico') or file:find('images') then
        header('HTTP/1.1 200 OK')
        header('Cache-Control: max-age=864000')
        sendfile(file)
    else
        header({'Expires:Thu, 19 Nov 1981 08:52:00 GMT',
                'Pragma:no-cache'})
 
        dofile(file)
    end
else
    header('HTTP/1.1 404 Not Found')
    die('File Not Found!')
end
 
die()

以上所述的全部内容了,希望大家能够喜欢。

您可能感兴趣的文章:
  • Nginx+Lua+Redis构建高并发Web应用
  • Lua读取和写入文件处理例子
  • C语言中通过LUA API访问LUA脚本变量的简单例子

标签:湖南 仙桃 铜川 黄山 湘潭 崇左 衡水 兰州

巨人网络通讯声明:本文标题《基于 aLi Lua Web Server 的一个简单例子》,本文关键词  ;如发现本文内容存在版权问题,烦请提供相关信息告之我们,我们将及时沟通与处理。本站内容系统采集于网络,涉及言论、版权与本站无关。
  • 相关文章
  • 收缩
    • 微信客服
    • 微信二维码
    • 电话咨询

    • 400-1100-266