在 lighttpd 上从 PNG 文件运行 PHP

发布于 2024-09-15 03:45:27 字数 100 浏览 1 评论 0原文

我只需要对一个文件 (uptime.php) 执行此操作,并且必须使用 uptime.png 来请求该文件。

在我的配置文件中为所有 png 文件添加规则将是自杀..:P

I only need to do this for one file (uptime.php) and it must be requested by using uptime.png.

Adding a rule for all png files in my config file would be suicide.. :P

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

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

发布评论

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

评论(1

你的呼吸 2024-09-22 03:45:28

一般来说,不需要使用 uptime.png 来请求:您可以使用 .php 扩展名。只要您的脚本输出

Content-type: image/png

为 MIME 类型,浏览器就会将数据识别为图像。

但是,如果您确实必须使用 uptime.png 作为 URL,则可以使用重写规则。例如:

url.rewrite-once = ( "^/uptime\.png$" => "/uptime.php" )

Lighttpd 文档中有有关这些重写规则的更多信息:: ModRewrite 文档

In general, it does not need to be requested by using uptime.png: you can use a .php extension. As long as your script outputs

Content-type: image/png

as the MIME type, browsers will recognise the data as an image.

However, if you really must use uptime.png for the URL, you can use a rewrite rule. For example:

url.rewrite-once = ( "^/uptime\.png$" => "/uptime.php" )

There is more information about these rewrite rules in the Lighttpd Docs::ModRewrite documentation.

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