PHP函数收藏---不断更新中!
生活随笔
收集整理的這篇文章主要介紹了
PHP函数收藏---不断更新中!
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
替換html標簽 function strip_bad_tags($html) { $s = preg_replace ("@?[^>]*>*@", "", $html); return $s; } 替換指定tag,$text是需要替換的文本,tags 是需要替換標簽的數(shù)組 function strip_selected_tags($text, $tags = array()) { $args = func_get_args(); $text = array_shift($args); $tags = func_num_args() > 2 ? array_diff($args,array($text)) : (array)$tags; foreach ($tags as $tag){ if(preg_match_all('/]*>(.*)/iU', $text, $found)){ $text = str_replace($found[0],$found[1],$text); } } return $text; }
轉載于:https://www.cnblogs.com/eicesoft/archive/2007/12/06/985607.html
總結
以上是生活随笔為你收集整理的PHP函数收藏---不断更新中!的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: iOS手势UIGustureRecogn
- 下一篇: 【PHP入门到精通】:Ch05:字符串处