当前位置:Gxlcms > PHP教程 > php正则问题,我想匹配(rn)出现两次的地方分割

php正则问题,我想匹配(rn)出现两次的地方分割

时间:2021-07-01 10:21:17 帮助过:4人阅读

$str = "fhd\r\n\r\nfdfk\r\n\r\nuuuuu";
$data = preg_split("(\r\n){2}", $str, -1);
print_r($data);

结果:

回复内容:

$str = "fhd\r\n\r\nfdfk\r\n\r\nuuuuu";
$data = preg_split("(\r\n){2}", $str, -1);
print_r($data);

结果:

    $str = "fhd\r\n\r\nfdfk\r\n\r\nuuuuu";
    $data = preg_split("/(\r\n){2}/", $str, -1);
    print_r($data);

人气教程排行