Switch language
zh
Switch theme
Light

不间断空格-none-breaking-space-(-u00a0)

从网上复制的一些文本可能含有特殊字符, 不间断空格(unicode 编码为 \u00a0)就是一种, 效果与 ’ ’ 普通空格类似, 但有不同. 不同: 对英文单词间使用普通空格, 会自动换行; 使用不间断空格连接的单词会被认为是一个单词而直接全部换到下一行, 这在 html 也是同样的效果. 图片.png

在 php 中使用 普通空格替换 不间断空格的方式

$str = "a a a";
$str = str_replace(chr( 194 ) . chr( 160 ), " ", $str);

参考自stackoverflow

🍀