gpt4 book ai didi

perl - 使用 Apache 和 mod_perl 提供动态生成图像的正确方法是什么?

转载 作者:行者123 更新时间:2023-12-05 01:15:54 25 4
gpt4 key购买 nike

我有一个正在运行的 Apache2/mod_perl2 系统。

我正在使用 GD即时创建一个图像,然后我像这样打印它:

$r->content_type('image/png');
binmode STDOUT;
print $im->png;

但这是在 mod_perl2 中做事的正确方法吗? ?

(忽略我正在动态生成图像而不是缓存它等的事实......)

最佳答案

在 mod_perl2 下,您不应该将内容直接打印到 STDOUT。相反,使用

use Apache2::Const 'OK';

$r->content_type( 'image/png' );
$r->print( $im->png );

return OK;

关于perl - 使用 Apache 和 mod_perl 提供动态生成图像的正确方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2507824/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com