基于 aLi Lua Web Server 的一个简单例子
file='index.lua'
ifheaders.uri~='/'thenfile=headers.uriend
localfexists=file_exists(file)
ifnotfexiststhen
--trystatfile.lua
fexists=file_exists(file..'.lua')
iffexiststhen
file=file..'.lua'
end
end
iffexiststhen
iffile:find('.css')orfile:find('.js')orfile:find('font')orfile:find('.ico')orfile:find('images')then
header('HTTP/1.1200OK')
header('Cache-Control:max-age=864000')
sendfile(file)
else
header({'Expires:Thu,19Nov198108:52:00GMT',
'Pragma:no-cache'})
dofile(file)
end
else
header('HTTP/1.1404NotFound')
die('FileNotFound!')
end
die()
以上所述的全部内容了,希望大家能够喜欢。
热门推荐
3 祝福语简短的微信
10 幼儿祝福语大全简短贺卡
11 感谢教官文案祝福语简短
12 鼠年同事祝福语简短创意
13 元旦祝福语 简短独特群发
14 妈咪跟我生日祝福语简短
15 给儿子新婚祝福语简短
16 伴娘祝福语长文案简短
17 恭喜高考完祝福语简短
18 生日祝福语送老公简短