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.
是否可以安排文件权限/组所有权/等,以便函数可以读取文件以readFile()进行强制下载,但不能通过导航到文件的文字 url 来下载文件?
readFile()
也许您可以将运行 apache / php 的用户添加到拥有该文件的组中。并将配置设置为所有者和所有者组的读写权限,其他人则完全没有权限。(-rwxrw---- 0r 0760)
从未测试过它,但它应该可以工作。
Apache 用户将需要read权限。为了防止它被导航到,最好的(也是最简单的)解决方案是将文件存储在 web 文件夹之外。
read