第一種方法:linux
用常量吧,兼容windows,linux $arr = explode(PHP_EOL, $str);windows
第二種方法:數組
$text= nl2br($text);//將分行符"\r\n"轉義成HTML的換行符"<br />"
$textArr= explode("<br />",$text);//"<br />"做爲分隔切成數組
第一種方法:linux
用常量吧,兼容windows,linux $arr = explode(PHP_EOL, $str);windows
第二種方法:數組
$text= nl2br($text);//將分行符"\r\n"轉義成HTML的換行符"<br />"
$textArr= explode("<br />",$text);//"<br />"做爲分隔切成數組