www.rqgq.net > php根据换行分割字符串

php根据换行分割字符串

换行符咯 "\n"

或 双引号内的\n会被转义为换行符

$name=$_POST['name']; $sex=$_POST['sex']; $email=$_POST['email']; $info=$_POST['info']; echo $name.''; echo $sex.''; echo $email.''; echo $info.'';

用str_replace()函数。 $content = str_replace("\n"," ",$content);

输出结果为: 111 222

str_replace('\r\n','',$str);

$arr = explode("\n",$content);foreach($arr as $k=>$v){ $arr[$k] = trim($v);}print_r($arr);

网站地图

All rights reserved Powered by www.rqgq.net

copyright ©right 2010-2021。
www.rqgq.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com