开发者

What is the best type to use for a column in MySQL containing the body of text output by a CMS?

I'm doing a quick and dirty CMS module for a site - just a jWYSIWYG editor.

I've never really thought about the best type to use for the column that will contain the outputted XHTML from the editor. I have a开发者_JS百科lways used blob in the past, but am unsure why I picked that.

Any recommendations?


Well, since you're storing XHTML data in the database (whether that is acceptable or not is an entirely separate discussion), it's not unreasonable to use a TEXT column instead, since that's all XHTML really is.

Of course, you will want to mind your character encoding.


I would suggest that you just use TEXT. Or if you're concerned about having a large enough space, then you could use LONGTEXT.


TEXT is the safest because you won't be limiting the field size in any way, (however you might want to throw a limit in there anyway) and will probably accept the most exceptions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜