PHP function substr() error

后端 未结 7 2021
攒了一身酷
攒了一身酷 2020-12-29 22:23

When I use substr() I get a strange character at the end

$articleText = substr($articleText,0,500);

I have an output of 500 c

7条回答
  •  猫巷女王i
    2020-12-29 23:01

    Looks like you're slicing a unicode character in half there. Use mb_substr instead for unicode-safe string slicing.

提交回复
热议问题