1

在 CKEditor 中,我有一个非常基本的页面,上面有一个表单。该表单有一个元素 - textarea - 我的用户可以在其中创建 HTML

我希望我的用户能够单击屏幕上的一个按钮,然后打开“另存为”框,能够将该文本区域的内容保存到其本地服务器上的 HTML 文件中。

到目前为止,我的代码几乎就是这样:

<form method="post">
   <textarea name="editor1"></textarea>
   <script>
        CKEDITOR.replace("editor1");
   </script>
   <input type="submit">
</form>
4

1 回答 1

1

您可以将文本发布到 php 文件中。

在 php 文件中,您设置以下标头:

header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=somename.html");
header("Content-Transfer-Encoding: binary");
header("Content-Type: application/force-download");

之后,您只需从编辑器中输出 html。

于 2013-09-03T12:15:04.623 回答