试试这个:
$pattern = '/[\x{ff0c},]/u';
//$string = "something here ; and there, oh,that's all!";
$string = 'hei,nihao,a ';
echo '<pre>', print_r( preg_split( $pattern, $string ), 1 ), '</pre>';
exit();
输出:
<pre>Array
(
[0] => hei,nihao,a
)
</pre>
答案 0 :(得分:0)
您拥有的字符是全角逗号(hex ff0c),以及常规逗号。您是否尝试将其更新为我的版本?
<?php
$pattern = '/[\x{ff0c},]/u';
//$string = "something here ; and there, oh,that's all!";
$string = 'hei,nihao,a ';
echo '<pre>', print_r( preg_split( $pattern, $string ), 1 ), '</pre>';
输出:
Array
(
[0] => hei
[1] => nihao
[2] => a
)