是的你可以
简单的一步一步:
1-创建一个与以下内容相同的文件夹:images
2-在图像文件夹中创建一个名称为:image_folder 的文件夹并将您的图像文件放在“image_folder”中
3-通过此内容创建一个 .htaccess 文件
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^index\.php$ -
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
</IfModule>
4- 通过以下内容在 images 文件夹中创建 index.php:
<?
$filename = urldecode(end(explode('/',$_SERVER['REQUEST_URI'])));
$subname = current(explode('.',$filename));
$extention = end(explode('.',$filename));
switch ($extention) {
case 'gif':
$mime = 'image/gif';
break;
case 'jpg':
case 'jpeg':
case 'jpe':
$mime = 'image/jpeg';
break;
case 'png':
$mime = 'image/png';
break;
case 'ico':
$mime = 'image/x-icon';
break;
default:
header("HTTP/1.0 404 Not Found");
echo('image not finded');
exit;
break;
}
if(is_file("image_folder/".$filename)){
header("Content-type: ".$mime);
readfile("image_folder/".$filename);
}else{
header("HTTP/1.0 404 Not Found");
echo('image not finded');
}
解释:现在您可以轻松地在 index.php 中查看referer