PHP 字符串换行转换成数组
$str = "你好 不好 非常好"
;
$preg = preg_split('/[;\r\n]+/s', trim($str));//参数一,正则表达式,参数二,转换的字符串
输出:array(3) { [0] => string(6) "你好" [1] => string(6) "不好" [2] => string(9) "非常好" }
$str = "你好 不好 非常好"
;
$preg = preg_split('/[;\r\n]+/s', trim($str));//参数一,正则表达式,参数二,转换的字符串
输出:array(3) { [0] => string(6) "你好" [1] => string(6) "不好" [2] => string(9) "非常好" }