Home >Backend Development >PHP Tutorial > php中除了html标签属性的方法

php中除了html标签属性的方法

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:45:21833browse

php中去除html标签属性的方法
比如代码如下:

<br />
$str = '<span style=\"font-family:\'Arial\',\'sans-serif\';font-size:9pt;\">test</span>';<br />
$str=stripslashes($str);<br />
echo htmlspecialchars($str)."<br/>";<br />

希望输入的是:test
总之:不管$str里的标签内含有任何属性都去除掉,只保留标签本身。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn