php - json_encode之后,中文存到数据库变成了unicode,长度是怎么算的?
某草草
某草草 2017-05-16 13:08:03
0
2
419

我发现 数组中的 中文经过json_encode之后,存到数据库变成了unicode。
例如:“我是个中文”,
变成了:

\u6211\u662f\u4e2a\u4e2d\u6587

本来“我是个中文”,共记10个字符。
变成了unicode之后,是不是就 共记30个字符???

text长度65535,如果能直接保存中文,大概能有3万多个中文。
如果变成了unicode,那能保存的中文岂不是只有6500个左右?

如果text长度不够用,改为 mediumtext,会不会使数据库变得又大又慢?

一共3个问题,麻烦请教一下。新手请见谅。

某草草
某草草

reply all(2)
Ty80

Performance will definitely be affected. All usual storage of such large text would create a separate table.

巴扎黑

YesJSON_UNESCAPED_UNICODE, save Chinese directly without escaping.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!