strip_tags,strip_tags java
strip_tags — 从字符串中去除 HTML 和 PHP 标记?
这函数挺有用的,这是总结后的知识点,希望能帮到你!
strip_tags
(PHP 4, PHP 5, PHP 7, PHP 8)
strip_tags — 从字符串中去除 HTML 和 PHP 标记
说明
strip_tags ( string $str , string $allowable_tags = ? ) : string
该函数尝试返回给定的字符串 str 去除空字符、HTML 和 PHP 标记后的结果。它使用与函数 fgetss() 一样的机制去除标记。
参数
str
输入字符串。
allowable_tags
使用可选的第二个参数指定不被去除的字符列表。
注意:
HTML 注释和 PHP 标签也会被去除。这里是硬编码处理的,所以无法通过 allowable_tags 参数进行改变。
注意:
In PHP 5.3.4 and later, self-closing XHTML tags are ignored and only non-self-closing tags should be used in allowable_tags. For example, to allow both
and , you should use:');
?
返回值
返回处理后的字符串。
strip_tags转换html代码如何过滤
如果只是考虑去掉style样式,完全可以考虑用jquery来实现
$("p").removeAttr("style");就可以了
strip_tags怎么过滤数据库里的东西,格式怎么写
你好,假如你的PHP代码是这样的
$string = "a href="#"log out/aiframeiframe goes away/frame pparagraphed/p
div style='color:green'div kept./div";
$smarty-assign('string', $string);
那么此时你的smarty文件应该这样写
{$string|strip_tags:"a"} //这样就会将所有的a标签留下,当然你还可以添加和减少其他的一些特定标签,
PHP懂strip_tags($str)的请来!
meta name="description" content="?php echo substr(preg_replace('~.*~',"",$log_content)); ?" /
看看是这个意思不