Home  >  Q&A  >  body text

前端 - 如何存长篇文章到数据库mysql,然后是有格式的,然后,再取出来也是有格式的?

如何存长篇文章到数据库mysql,然后是有格式的,然后,再取出来也是有格式的?

也就是说,一般的网站的文章的格式,是如何存和取的,才显得可观一点??

在后端,写编辑文章写入数据库的功能的时候,这块怎么处理??

怪我咯怪我咯2741 days ago593

reply all(4)I'll reply

  • 高洛峰

    高洛峰2017-04-17 14:29:45

    The simplest way is to filter the articles and store them in the database, and then parse them when they are taken out.

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 14:29:45

    Is the questioner overly concerned?
    Using mysql’s text type to save rich text, no formatting problems were found.

    Let’s try it.

    reply
    0
  • 迷茫

    迷茫2017-04-17 14:29:45

    Baidu has that ueditor link: http://ueditor.baidu.com/website/
    Use this directly to render to the front-end page. After filling in the information, the back-end directly inserts it into the database. The corresponding article fields in the database use text. That's it.
    When you take it out, some frames come with filtering html tags. You can just choose not to filter them at that time.

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 14:29:45

    Save the large text data with html format into the field of text data type, and then process it on the front end

    reply
    0
  • Cancelreply