php如何去除字符串中的注释

在php中使用strip_tags()函数去除字符串中的注释,具体方法如下:

strip_tags()函数作用:

php中strip_tags()函数的作用是用于剥除字符串中HTML、XML和PHP的标签与注释。

strip_tags()函数语法:

strip_tags(string,allow)

参数:

string:指定字符串。

allow:需要保留的注释或标签。

strip_tags()函数使用方法:

echo strip_tags("Hello world!","");

>>>Hello world!

赞(0)
未经允许不得转载:主机测评网 » php如何去除字符串中的注释
分享到: 更多 (0)