Php 如何使用.htaccess将另一个文件返回到客户端?

Php 如何使用.htaccess将另一个文件返回到客户端?,php,.htaccess,download,Php,.htaccess,Download,我想返回“download.php?file=filename”的内容,如果有人请求“filename.rar”这将使您的服务器成为一扇敞开的大门,任何人都可以获取他们想要的任何文件,但是。。。它做你想要的 <?php readfile($_REQUEST['file']); 或 我认为你们应该研究一下修改,然后从你们并没有读过的问题开始。他想把file.rar改为download.php?file=file.rar谢谢。你能告诉我“引擎打开”是什么意思吗? <?php

我想返回“download.php?file=filename”的内容,如果有人请求“filename.rar”

这将使您的服务器成为一扇敞开的大门,任何人都可以获取他们想要的任何文件,但是。。。它做你想要的

<?php
    readfile($_REQUEST['file']);


我认为你们应该研究一下修改,然后从你们并没有读过的问题开始。他想把file.rar改为download.php?file=file.rar谢谢。你能告诉我“引擎打开”是什么意思吗?
<?php
    readfile($_REQUEST['file']);
if(isset($_GET[file]))

 header("Location: PATH TO FILE");
$filename = 'FILENAME';
$file = 'PATH TO FILE';


header("Content-Disposition:  inline; filename=".$filename);
header("Content-Type: application/octet-stream");
header("Content-Length: ".filesize($file));
header("Pragma: no-cache");
header("Expires: 0");
$fp=fopen($file,"r");
print fread($fp,filesize($file));
fclose($fp);
exit();