我的根目录下有一个htaccess文件,其中包含以下缓存指令:
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
现在我注意到,当我使用php/ajax上传图片时,第一次预览显示正确的图片,然而如果我重新上传/覆盖图片,则预览不会更改,这可能是由于htaccess缓存指令造成的。
是否可以只在目录/upload/中删除缓存,或者更好地,在upload/preview php脚本中禁用缓存,以便始终正确显示预览?