php - CKEditor 输出为 BBcode 格式而不是 HTML

标签 php mysql ckeditor

我在表单中使用 CKEditor。当我提交该表单时,我在 CKEditor 的文本区域中写入的内容将以这种格式保存在数据库中 [b]hello[/b][size=100]fefdf[/size]:*).在另一个页面中,当我检索数据时,它以 HTML 形式显示为相同的 [b]hello[/b][size=100]fefdf[/size]:*) 而不是 BBCode 格式的输出。谁能帮助我如何获取 BBcode 格式的文件?

我想要什么:

What I want

我得到了什么:

What I am getting

最佳答案

我推断,当您调用编辑器时,BBCode 选项已激活(请参阅 this example code ),因此这不应该是问题。

您可以尝试的一件事是设置 basicEntities配置为false

取自 CKeditor API :

<static> {Boolean} CKEDITOR.config.basicEntities Since: 3.0

Whether to escape basic HTML entities in the document, including:

  • nbsp
  • gt
  • lt
  • amp

Note: It should not be subject to change unless when outputting a non-HTML data format like BBCode.

Defined in: plugins/entities/plugin.js.

config.basicEntities = false;

Default Value:

true

关于php - CKEditor 输出为 BBcode 格式而不是 HTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8558039/

相关文章:

php - 不需要的 <p><span><div> 标签被插入到数据库中

javascript - CKEditor 即时编辑配置

php - 从 PHP 数组结果中删除字符串长度值

javascript - 将 HTML 推送到网页(JS VS PHP)

php - Mysql统计连接字段

php - 数据库连接失败

heroku - 使用 Heroku 在生产 Rails 应用程序上运行 ckeditor 的问题

php - MySQL 不能通过 CodeIgniter 工作,但在 vanilla PHP 中工作正常?

Javascript DateTime 与 MySQL 日期和时区

php从mysql中删除行