MySQL数据库中的TinyMCE格式文本 [英] TinyMCE formatted text in MySQL database

查看:268
本文介绍了MySQL数据库中的TinyMCE格式文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找这个问题的答案已经有一段时间了,我还没有找到合适的答案。



我想使用TinyMCE允许用户发布格式化的博客。我不想强迫用户在textarea中使用HTML标签来放置一个新的段落,他们应该能够按回车键来获得一个新的行,按下按钮来获得粗体文本等...我的问题是,如果我将这些博客文章存储在MySQL数据库中,我怎样才能安全地保存数据库中的格式,然后显示数据库中的博客文章格式不变?

使用解决方案

> getContent
$ b

  tinyMCE.activeEditor.getContent ); 

它将返回您当前的tinymce编辑器的HTML,并且您可以将它发送到您的服务器。 / p>

I have been searching for an answer for this for quite some time now, and I haven't been able to find a logical one yet.

I want to use TinyMCE to allow users to post formatted blogs. I don't want to force the user to use HTML tags in the textarea to put a new paragraph, they should just be able to hit the return key to get a new line, push a button to get bolded text, etc... My question is, if I am storing these blog posts in a mysql database, how can I preserve the formatting in the database securely and then show the blog post from the database with the formatting intact?

解决方案

Use getContent:

tinyMCE.activeEditor.getContent();

it will return you the HTML of current tinymce editor, and you can send it to your server.

这篇关于MySQL数据库中的TinyMCE格式文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆