$str='
Factory Supply High Quality Maitake Mushroom Extract Powder Bulk
echo $content= str_replace("
","",$str);
很完美
php的str_replace函数怎么把
php的str_replace函数怎么把
$html="
fdasf
";echo $string = str_replace(array("
","","
"),"",$html);br
若是
内容
替换成内容
content
替换成contend
(空格是tab键和空格键 混合的 都有可能)方法如下$html=preg_replace('/[\n\r\t]/','',$html);//去空格
若是
后面跟了若干个,再是内容
内容
替换成
内容
content
替换成
contend
$html="
内容
替换成内容
content
替换成contend
";方法如下$html=trim($html);
$html=str_replace(PHP_EOL,"",$html);
$html=str_replace(" ","",$html);
$html=preg_replace('/\s+/','',$html);
$html=preg_replace('/[\n\r\t]/','',$html);
echo "{$html}";
?>
str_replace("
","",$htmlstr);
标签:替换成,replace,content,正则,html,nbsp,str,php
来源: https://www.cnblogs.com/yuesha/p/11319779.html