我在nginx.conf 文件里面配置的是access_by_lua_file test.lualocation /test {}test.lua里面写的是local args = ngx.req.get_uri_args()ngx.say(#args)输出0然后用curl http://localhost:80/test?param=testargs = ngx.req.get_uri_args()获得的结果竟然会是nil,很奇怪,有人知道吗? --
http://rangercyh.blog.51cto.com/1444712/1032925建议你看看这个在 2014年12月19日 下午3:38,Phoenixxz Edent <conti...@gmail.com>写道:我在nginx.conf 文件里面配置的是access_by_lua_file test.lualocation /test {}test.lua里面写的是local args = ngx.req.get_uri_args()ngx.say(#args)输出0然后用curl http://localhost:80/test?param=testargs = ngx.req.get_uri_args()获得的结果竟然会是nil,很奇怪,有人知道吗? --
uint32_t magic; uint32_t count; uint32_t item_count; uint32_t filesize;
Hello! 2014-12-20 22:05 GMT-08:00 jie123108: > local shm = ffi.C.mmap(nil, filesize, ffi.C.PROT_READ, ffi.C.MAP_SHARED, fd, > 0); > 怎么将shm变成my_head_t类型的? > 可以使用 ffi.cast() 函数: http://luajit.org/ext_ffi_api.html#ffi_cast Regards, -agentzh
>可以使用 ffi.cast() 函数: > http://luajit.org/ext_ffi_api.html#ffi_cast 谢谢春哥,用ff.cast解决了,下面是个示例:ffi = require("ffi") ffi.cdef[[ void *calloc(size_t nmemb, size_t size); typedef struct my_head{ uint32_t magic; uint32_t count; }my_head_t; ]] p = ffi.C.calloc(100, 1) myhead = ffi.cast("my_head_t*", p) myhead.magic = 101 myhead.count = 123 print(myhead.magic)之前转换时,我也是用的ffi.cast,但由于我的疏忽,一直传的是结构体名,忘记了加*号。导致一直报类型错误。 jie1...@gmail.com