简体   繁体   English

使用PHP存储和获取多个段落

[英]Storing and fetching multiple paragraphs using PHP

So I am working on a small project and using PHP/MySQL so far. 所以我到目前为止正在开发一个小项目并使用PHP / MySQL。
I wanted to know how do I go on storing very long text (let's say a user inputs a lot of paragraphs at once). 我想知道如何存储很长的文本(假设用户一次输入很多段落)。 Is using SQL for saving the text a good idea? 使用SQL来保存文本是一个好主意吗? Or should I save the huge amount of text using some other method instead? 或者我应该使用其他方法保存大量文本? Thanks! 谢谢!

EDIT: Forgot to mention I am currently using LONGTEXT to store the text. 编辑:忘记提及我目前正在使用LONGTEXT来存储文本。 I just wanted to know if it's a good approach to store such amount of text in a db. 我只是想知道在数据库中存储这么多文本是不是一个好方法。

It's fine to store long text in Mysql database, just make sure you use appropriate column type in mysql database: 可以在Mysql数据库中存储长文本,只需确保在mysql数据库中使用适当的列类型:

TEXT - Holds a string with a maximum length of 65,535 characters TEXT - 保存最大长度为65,535个字符的字符串

MEDIUMTEXT - Holds a string with a maximum length of 16,777,215 characters MEDIUMTEXT - 保存最大长度为16,777,215个字符的字符串

LONGTEXT - Holds a string with a maximum length of 4,294,967,295 characters LONGTEXT - 保存最大长度为4,294,967,295个字符的字符串

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM