我想用给定字符串中的三个句点(...)替换水平椭圆(...).
直到现在我尝试过:
str_replace('…','...', $text);
str_replace('…', '...', $text);
str_replace('&hellips', '...', $text);
但无法获得所需的输出.你能为它提出一些方法吗?
编辑:
我面临的另一个问题是当我在编辑器中粘贴〜... ~u字符时(我正在使用Editplus).......被转换成矩形.(见截图).
谢谢
尝试将 preg_replace 与 /u 修饰符一起使用(该字符串被视为 unicode 字符串):
\n\n$result = preg_replace('~\xe2\x80\xa6~u', '...', $string);\nRun Code Online (Sandbox Code Playgroud)\n