Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我找到了这个解决方案
$content=preg_replace('/[^\pL\p{Zs}]+/u', '', $string);
它会删除除 utf-8 字符之外的所有内容,但我需要除 utf-8 字符和数字之外的所有内容,这可能吗?
您可以尝试在范围内添加数字 (\d)
$content=preg_replace('/[^\d\pL\p{Zs}]+/u', '', $string);