php怎么去掉字符串空行

php去掉字符串空行的方法:1、创建一个PHP示例文件;2、通过“function DeleteHtml($str){...}”方法去掉html中的空行或空白即可。

本文操作环境:Windows7系统、PHP7.1版、DELL G3电脑

php怎么去掉字符串空行?

PHP去掉html中的空行、空白函数

function DeleteHtml($str){  
                    $str = trim($str);  
                    $str = ereg_replace(\t,,$str);  
                    $str = ereg_replace(\r\n,,$str);  
                    $str = ereg_replace(\r,,$str);  
                    $str = ereg_replace(\n,,$str);  
                    return trim($str);  
                }

推荐学习:《PHP教程

相关文章

文章浏览阅读8.4k次,点赞8次,收藏7次。SourceCodester Onl...
文章浏览阅读3.4k次,点赞46次,收藏51次。本文为大家介绍在...
文章浏览阅读1.1k次。- php是最优秀, 最原生的模板语言, 替代...
文章浏览阅读1.1k次,点赞18次,收藏15次。整理K8s网络相关笔...
文章浏览阅读1.2k次,点赞22次,收藏19次。此网络模型提供了...
文章浏览阅读1.1k次,点赞14次,收藏19次。当我们谈论网络安...