3
我试图缓存已经生成的图像。您可以通过resize.php访问文件来创建图像?width = x & height = y。 如果该宽度和高度的图像不存在,我使用imagemagick来创建它。但是,如果它确实存在,它将被提供给访问者。用PHP缓存生成的图像
!file_exists($ name)检查工作正常,因此在不需要处理时不会处理。但是图像还需要一段时间才能加载。
我的阅读文件的方法不正确,或者我错误地设置了标题?
if (!file_exists($name)) {
//image processing here
}
header("Content-Type: image/png");
header("Expires: Sat, 25 Jul 2020 10:00:00 GMT");
readfile($name);
谢谢。
啊哈,呃!谢谢您的帮助!我知道php脚本自动不会被缓存,所以readfile每次只是读取图像。 – lafoaug 2010-06-14 15:49:36