lua
软考鸭
分享技术和心得
展开
-
openresty之http
使用过程 1.下载resty.http 库 2.将lib/resty文件夹下的http.lua 和http_headers.lua两个文件复制到 openresty的lualib/resty 目录下 常见报错 1. no resolver defined to resolve 解决办法 在location标签下添加 resolver 8.8.8.8; 2. unable to get local issuer certificate 解决办法 //关闭ssl检验 ssl_verify =false原创 2022-04-03 19:09:39 · 3819 阅读 · 0 评论 -
openresty之hello world
1. 测试代码写在/usr/local/openresty/nginx/conf/nginx.conf文件里 //新加location location /test{ //设置默认输入 default_type text/html; content_by_lua 'ngx.say("hello world ")'; } 2.重启nginx nginx -s reload原创 2022-03-12 21:08:39 · 2744 阅读 · 0 评论 -
openresty安装(centos)
1. 首先安装依赖包 yum install readline-devel pcre-devel openssl-devel gcc GeoIP-devel 2.下载最新源码 wget https://openresty.org/download/openresty-1.19.9.1.tar.gz 3.解压 tar -xzvf openresty-1.19.9.1.tar.gz 4.进入目录配置 cd openresty-1.19.9.1 ./configure --with-http_geoip_原创 2022-03-12 20:07:10 · 3665 阅读 · 0 评论 -
lua 类型转换
1.数字转字符串 tostring(1) 2.字符串转数字 tonumber(“1”)原创 2021-08-20 21:22:12 · 566 阅读 · 0 评论 -
lua产生随机数
– 将os.time()获取的系统秒数数值翻转(低位变高位),再取高6位,这样即使time变化很小 – 由于低位变高位,数值就会变化很大,这样1秒内进行多次运行的话,效果会好些 local next = tostring(os.time()):reverse():sub(1, 6) math.randomseed(next ) ...原创 2021-08-20 20:29:22 · 767 阅读 · 0 评论