简体   繁体   English

PHP中的简单rtf文件

[英]simple rtf file in php

Can anyone help me to create simple .rtf file using php? 谁能帮助我使用php创建简单的.rtf文件? For example: I have a page: 例如:我有一个页面:

<table>
<tr><td>ID</td><tr><td>sth</td></tr>
<tr><td>1</td><tr><td>sth1</td></tr>
<tr><td>1</td><tr><td>sth1</td></tr>
<tr><td>1</td><tr><td>sth1</td></tr>
</table>

I want to create a .rtf file with this table to let user to edit it using program like MS Word. 我想用此表创建一个.rtf文件,以允许用户使用MS Word之类的程序对其进行编辑。 I was trying with this: http://books.msspace.net/mirrorbooks/php5/067232511X/ch28lev1sec1.html but it did not help me. 我正在尝试使用此方法: http : //books.msspace.net/mirrorbooks/php5/067232511X/ch28lev1sec1.html,但它没有帮助我。

// $rtf holds your complete file data // $ rtf保存您完整的文件数据

// save file on your server 1st //将文件保存到服务器1号

file_put_contents('/path/to/outfile.rtf', $rtf);

// then offer it as download //然后提供下载

header("Content-type: application/rtf");
echo file_get_contents("/path/to/outfile.rtf");
exit();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM