Php regex发行符号

问题描述 投票:0回答:1

在发送邮件功能中,我具有用于解码头的代码:

preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);

如果字符串中的符号是符号,例如'ä'(März),则它将返回空字符串。请帮助我,我该如何解决? (也可以使用德国符号)。谢谢!

php regex preg-match
1个回答
0
投票

只需为Unicode添加/u标志:

preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/u', $str, $matches);
#                                               here __^

0
投票

尝试在定界符之后添加'u':

$str="März";
preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/u', $str, $matches);
print_r($matches);
© www.soinside.com 2019 - 2024. All rights reserved.