【问题标题】:How check the size byte of paragraph string UTF-8 by php?如何通过php检查段落字符串UTF-8的大小字节?
【发布时间】:2016-04-23 09:41:33
【问题描述】:

我有 UTF-8 字符串如下:

Công ty tnhh một thành viên

我访问网页:https://mothereff.in/byte-counter 并在 textarea 中过滤文本 utf-8。

它将显示“这是 27 个字符,共 32 个字节。#”

那么,如何用php检查字节文本utf-8等于"32 bytes"

我一直在使用函数strlen(),但返回结果是27,而不是32

非常感谢!

【问题讨论】:

标签: php utf-8 byte


【解决方案1】:

strlen() 是您要查找的内容,来自 php 网站:

注意: strlen() 返回字节数而不是字符串中的字符数。

php.net查看更多信息

【讨论】:

    猜你喜欢
    • 2013-04-26
    • 2011-06-17
    • 2018-09-07
    • 2011-01-23
    • 1970-01-01
    • 2019-07-30
    • 2012-01-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多