【发布时间】:2013-06-23 21:50:03
【问题描述】:
我有一个 PHP 脚本,用于显示根目录下的图像。在Javascript中,当我使用脚本显示图像时,图像正常显示。但是,如果在未重新加载页面的情况下修改图像,则会显示旧图像而不是新图像。我试图为图像添加时间戳,但似乎这只在通过脚本显示图像时才有效。 PHP中图像显示的代码:
<?php
$content = file_get_contents( $_GET['arquivo'] );
if( $content !== false ){
echo $content;
}
else{
echo 'not found';
}
?>
使用此脚本的示例图像:
<img src = "http://www.mysite.com/general/showimage.php?arquivo=/directory/temp1.jpeg">
我试过这个:
<img src = "http://www.mysite.com/general/showimage.php?arquivo=/directory/temp1.jpeg?k=123041">
但是,这样一来,就不会显示任何图像,即使是旧的也不会。
我在不重新加载页面的上传系统上使用它。
【问题讨论】:
-
使用
&分隔多个参数,而不是?。
标签: php javascript image caching upload