比如nginx的如下判断if (!-e $php_url.php) { return 403; } 请问lua如何实现
local f = io.open('a.txt')if not f then -- f == nil, file not exists print(404)end --blog: http://chenxiaoyu.org On Wed, Jul 25, 2012 at 11:31 PM, loveshell <linuxr...@gmail.com> wrote: 比如nginx的如下判断if (!-e $php_url.php) { return 403; } 请问lua如何实现
比如nginx的如下判断if (!-e $php_url.php) { return 403;} 请问lua如何实现
Hello! On Thu, Jul 26, 2012 at 3:53 PM, loveshell <linuxr...@gmail.com> wrote: > 自带没这类判断吗 > 标准 Lua 有意把自己限制在标准 C 语言的范围内。标准 C 语言并没有定义专门判断文件和目录存在的 API,所以 Lua 也没有内建这样的接口。所以这需要依赖于特定于具体平台的扩展库。 Best regards, -agentzh
local f = io.open('a.txt')if not f then -- f == nil, file not exists print(404)end--blog: http://chenxiaoyu.org On Wed, Jul 25, 2012 at 11:31 PM, loveshell <linuxr...@gmail.com> wrote: 比如nginx的如下判断if (!-e $php_url.php) { return 403; } 请问lua如何实现