<?php header("content-type:text/html;charset=utf-8"); $str = "aaaa bbbb cccc dddd"; echo $str; echo ‘<br/>‘; echo nl2br($str); echo ‘<br/>‘; $str_a = str_replace(array("\r\n","\r","\n"),"",$str); echo $str_a; echo ‘<br/>‘; $str_b = str_replace(PHP_EOL,"",$str); echo $str_b; echo ‘<br/>‘; $str_c = preg_replace(‘/\s*/‘,‘‘,$str); echo $str_c; echo ‘<br/>‘; ?>
时间: 2024-10-11 23:43:24