Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为什么不通过将给定目录存根转发到 PHP 脚本的 RewriteRule 来处理下载?这对调用者来说是透明的,并允许你在脚本中做任何你想做的事情。
例如:
RewriteRule \A/downloads/((?!\.php).)*$ /downloads/index.php [L]
然后,您可以通过$_SERVER['REQUEST_URI']
$_SERVER['REQUEST_URI']