mb_ereg_replace
似乎不支持g
修饰符。有没有办法用多字节支持来查找和替换所有出现的事件?
答案 0 :(得分:1)
默认情况下该怎么办?
$original = html_entity_decode(
'Бинокли', ENT_COMPAT, 'UTF-8'
);
mb_regex_encoding('UTF-8');
$replaced = mb_ereg_replace('и', '!', $original);
echo "Original: $original", PHP_EOL;
echo "Replaced: $replaced", PHP_EOL;
输出:
Original: Бинокли
Replaced: Б!нокл!