PHP7中文手册2018 带注释 最新chm版
<?php
$string ="test
$string ="test
test2 test3 test4 test5"; $str = ''; foreach(explode("\n",$string) as $key) { $str .='\''.trim($key).'\','; } $array = explode(',',$str); echo "<pre>"; print_r($array); echo "</pre>"; foreach($array as $value) { if(!empty($value)) { //结果 处理 } } /*** 结果 Array ( [0] => 'test' [1] => 'test2' [2] => 'test3' [3] => 'test4' [4] => 'test5' ) ***/
转载请注明:谷谷点程序 » php把每次的内容转为数组