我是php的新手,我想使用tinymce编辑器,我想在tinymce编辑器中打开我的html文件,编辑后我想保存它。
下面是包含tinymce编辑器的代码
<script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
<script>请教我怎么做。
发布于 2013-10-11 15:31:34
为此,您必须研究一下file_get_contents()和file_put_contents()。
您可以通过AJAX发送它,方法如下(假设这就是您想要的):
// Replace .save-button with whatever button you use
$('.save-button').click(function()
{
var contents = tinyMCE.get('id-of-editor').getContent();
$.post('save_html_file.php', { content: contents }, function(data)
{
// Callback
});
});发布于 2013-10-11 15:24:01
使用getContent()函数,更新您的文本区并提交表单这里是一个有用的链接http://www.tinymce.com/wiki.php/API3:method.tinymce.Editor.getContent
示例
$("form").submit(function(){
$("#yourTextArea").value( tinyMCE.get('content id').getContent() );
});https://stackoverflow.com/questions/19312386
复制相似问题