Home >Operation and Maintenance >Nginx >What do $1, $2, and $3 in nginx stand for?
Nginx中,set $para $1,$1表示路径中正则表达式匹配的第一个参数。
(推荐学习:nginx教程)
以下是一个示例,用以实验$1,$2。如:
location ~/abc/(.*)/(.*) { set $para1 $1 set $para2 $2 content_by_lua_block { ngx.say(ngx.var.para1) ngx.say(ngx.var.para2) } }
此时,若访问路径为localhost:8080/abc/qwe/asd时,则浏览器会输出。
qwe asd
The above is the detailed content of What do $1, $2, and $3 in nginx stand for?. For more information, please follow other related articles on the PHP Chinese website!