在 Lighttpd 中使用字符串变量

发布于 2024-09-05 18:48:10 字数 302 浏览 2 评论 0原文

您好,我正在尝试执行此操作:

 $HTTP["url"] =~ "/([^/?]+)$" {
    setenv.add-response-header = (
    "Content-Disposition" => "attachment; filename=$1"
    )
 }

但它并没有将 $1 替换为正则表达式中存储的内容,而是仅替换 $1 个字符。

我想知道在 lighttpd 中是否可以实现类似的功能。

似乎使用正则表达式进行搜索/替换仅适用于这些重定向语法。

Hi I'm trying to do this:

 $HTTP["url"] =~ "/([^/?]+)$" {
    setenv.add-response-header = (
    "Content-Disposition" => "attachment; filename=$1"
    )
 }

but it did not replace $1 with what stored in the regex but just $1 characters.

I'm wondering if something like this is possible in lighttpd.

It seems like the search/replace with regex only works in those redirect syntaxes.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅忆 2024-09-12 18:48:10

我已经找到答案了。它必须通过 mod_magnet 来完成,它通过 lighttpd 配置绑定 LUA 脚本。

I've found the answer. It has to be done through mod_magnet which binds LUA scripting over lighttpd config.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文