1
工作假设$text = ea\r\ndad\r\n\r\nedade
PHP的换行符爆炸完全不
我的第一个代码:
$text = explode("\r\n",$text);
我的新代码
function splitNewLine($text) {
$code=preg_replace('/\n$/','',preg_replace('/^\n/','',preg_replace('/[\r\n]+/',"\n",$text)));
return explode("\n",$code);
}
$text = splitNewLine($text);
在这两种情况下,$text
结束了这样的:
Array
(
[0] => ea\r\ndad\r\n\r\nedade
)
我真的不知道为什么......这是关于它,没有更多的代码缺失,但它不会工作。任何想法为什么发生这种情况?
'使preg_split( '/ \ r吗?\ n /',$海峡, -1,PREG_SPLIT_NO_EMPTY);' –
@ SverriM.Olsen不,同样。这很奇怪AF – Fane
向我们展示您正在使用的代码。 http://sandbox.onlinephpfunctions.com/code/e013edc2b051715b03fa60b8ebc2fb108d787b63 –