2025年02月12日 建站教程
如何利用php语法去掉连续空格,下面web建站小编给大家详细介绍一下如何利用strip_tags()函数(剥去字符串中的 HTML、XML 以及 PHP 的标签)和str_replace()函数(函数替换字符串中的一些字符(区分大小写))具体实现代码!
具体实现代码如下:
<?php
$note = strip_tags($value['Content']);
$note = trim($note);
$note = str_replace(" ","",$note);
$note = preg_replace('#\s+#', ' ',trim($note));
$note = str_replace("<","<",$note);
$note = str_replace(">",">",$note);
$note = preg_replace("/[ ]{1,}/isu"," ",$note);
echo getsubstr($note,100);
?>
本文链接:http://so.lmcjl.com/news/23004/