是否有办法使apache服务器解释文件与。png扩展为。php?可以用。htaccess吗?
我。htaccessRewriteEngine On
AddType application/x-httpd-php .php .png
我image.png <?php
showImage();
function showImage()
{
$image = @imagecreatefrompng("../aimage.png");
header("Content-type: image/png;");
imagepng($image );
imagedestroy($image);
}
?>
不能用
当我去www.example.com/image.png我得到"图像无法显示,因为它包含错误",当image.png为image.php时,它会按原样显示图像
任何想法?
你说你有Apache?将此添加到您的.htaccess
或httpd.conf
文件中。
AddType application/x-httpd-php .php .foo