如何使用 php 保存 rtf 文件?
$rtf=<<<RTF
{\rtf1
\b [TITLE] \b0\par
\b [MESSAGE] \b0\par
}
RTF;
$rtf = str_replace('[TITLE]',$valueTitle,$rtf);
$rtf = str_replace('[MESSAGE]',$valueMessage,$rtf);
当我像上面那样在 php 中编辑完 rtf 文件后,如何使用新文件名将其保存在特定位置以供人们下载?
$rtf=<<<RTF
{\rtf1
\b [TITLE] \b0\par
\b [MESSAGE] \b0\par
}
RTF;
$rtf = str_replace('[TITLE]',$valueTitle,$rtf);
$rtf = str_replace('[MESSAGE]',$valueMessage,$rtf);
After I have finished editing a rtf file in php like above, how do i save it with a new file name in a specific location for people to download?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
file_put_contents()
保存它,并只需提供下载链接和适当的标头即可。然后您可以简单地给他们直接下载,或者使用正确的标头来提供它,如果您需要额外的处理或访问保护或其他东西,这很有用......
You can save it with
file_put_contents()
and simply offer the link to download, with the appropriate headers.Then you can either simply give them the direct download, or serve it with the right headers like this, useful if you need additional processing or access protection or something...
找到我已经完成此操作的旧文件,所以这就是我现在正在使用的确切工作代码。
found my old file where I had already done this, so this is the exact working code that I am using right now.