aLiLua.com

aLiLua 是一套基于 epoll/kqueue/Lua 构建的网络服务开发框架
aLiLua 使用 epoll 进行网络/文件IO事件读写,对Lua协程进行调度,其性能高效并且简单
Lua 语言就像 PHP 那么简单容易理解

 

 

当前版本: alilua-v0.51 stable (Web Server) / alilua-coevent-module-v1.0 (TCP Client)

 

 

网页例子:
local db = mysql:new()
local db_ok, err, errno, sqlstate = db:connect({
					host = "localhost",
					port = 3306,
					pool_size = 256,
					database = "db",
					user = "user",
					password = "***"})
if not db_ok then
	header('HTTP/1.1 503 ServerError')
	die('MySQL Connection Error.')
end

local res, err, errno, sqlstate = db:query("SELECT * FROM t1 LIMIT 1")
if not res then
	echo("bad result: ", err, ": ", errno, ": ", sqlstate, ".")
else
	echo("result: ", json_encode(res)..'\n')
end
Copyright © 2013-2016Lua | LuaJit | Fork me on GitHub