开发者

Is there a way to make apache server interpret files with .png extension as .php?

Is there a way to make apache server interpret files with .png extension as .php? Can it be done with .htaccess?

my .htaccess

RewriteEngine On
AddType application/x-httpd-php .php .png

my image.png

<?php

showImage();

function showImage()
{
    $image = @imagecreatefrompng("../aimage.png");
    header("Content-type: image/p开发者_JAVA百科ng;"); 
    imagepng($image );
    imagedestroy($image);
}

?>

and its not working.

When i go to www.example.com/image.png i get 'The image cannot be displayed because it contains errors', when that image.png is image.php it displays the image like it should.

Any ideas?


You say you have Apache? Add this to your .htaccess or httpd.conf file.

AddType application/x-httpd-php .php .foo
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜