In mod_python it's:
req.headers_out["Content-type"] = "application/force-download"
req.headers_out["Content-Disposition"] = "attachment; filename=%s" % filename
req.headers_out["Content-type"] = "application/force-download"
req.headers_out["Content-Disposition"] = "attachment; filename=%s" % filename
#/usr/local/apache/htdocs/segmentMusic
req.headers_out['Content-Disposition'] = 'handler; filename=%s.mp3' % random_num
本文介绍了如何通过设置HTTP响应头来实现特定文件的强制下载功能。具体包括将Content-Type设置为application/force-download以及使用Content-Disposition指定附件名称。
2546

被折叠的 条评论
为什么被折叠?



