读取文件系统并将其返回 [英] Reading filesystem and returning it
本文介绍了读取文件系统并将其返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如:
http://example.com/myfiles.php?source=images.zip
我需要myfiles。 php返回压缩文件的标题后跟其内容。
解决方案
您需要更改myfiles.php脚本文件中的标题所以它会强制它下载:
header(Cache-Control:public);
header(Content-Description:File Transfer);
header(Content-Disposition:attachment; filename = images.zip);
header(Content-Type:application / zip);
头(Content-Transfer-Encoding:binary);
In PHP I know how to read a file. However, I want the script to be able to return the contents of the file to be downloaded.
For example: http://example.com/myfiles.php?source=images.zip I need myfiles.php to returns the headers of zip file followed by its contents.
解决方案
You need to change the headers in myfiles.php script file so it will force it to download:
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=images.zip");
header("Content-Type: application/zip");
header("Content-Transfer-Encoding: binary");
这篇关于读取文件系统并将其返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文