Rumah > php教程 > php手册 > teks badan

PHP字符串特殊符号过滤方法示例

WBOY
Lepaskan: 2016-06-06 19:45:23
asal
1340 orang telah melayarinya

分享一个PHP字符串中特殊符号的过滤方法的例子,个人感觉还不错哦。 有时会遇到php过滤特殊字符的问题,一个处理特殊字符串的方法,可能有遗漏,有用到的兄弟可以自己补上。 完整代码: ?php /** * 过滤特殊字符的函数 * edit by www.jbxue.com */ function

分享一个PHP字符串中特殊符号的过滤方法的例子,个人感觉还不错哦。

有时会遇到php过滤特殊字符的问题,一个处理特殊字符串的方法,可能有遗漏,有用到的兄弟可以自己补上。

完整代码:

<span><?php </span></span>
Salin selepas log masuk
<span>/**</span>
Salin selepas log masuk
<span>* 过滤特殊字符的函数</span>
Salin selepas log masuk

* edit by  www.jbxue.com

<span>*/</span>
Salin selepas log masuk
<span>function</span> strFilter(<span>$str</span><span>){
</span><span>$str</span> = <span>str_replace</span>('`', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('·', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('~', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('!', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('!', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('@', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('#', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('$', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('¥', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('%', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('^', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('……', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('&', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('*', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('(', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>(')', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('(', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>(')', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('-', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('_', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('——', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('+', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('=', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('|', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('\\', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('[', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>(']', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('【', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('】', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('{', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('}', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>(';', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>(';', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>(':', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>(':', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('\'', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('"', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('“', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('”', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>(',', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>(',', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('$str<span>);
</span><span>$str</span> = <span>str_replace</span>('>', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('《', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('》', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('.', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('。', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('/', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('、', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('?', '', <span>$str</span><span>);
</span><span>$str</span> = <span>str_replace</span>('?', '', <span>$str</span><span>);
</span><span>return</span> <span>trim</span>(<span>$str</span><span>);
}</span>
Salin selepas log masuk

 

您可能感兴趣的文章:

  • php过滤字符串函数示例
  • php正则过滤特殊字符的方法
  • php过滤特殊字符sql防注入代码
  • php特殊字符过滤综合例子
  • php过滤特殊字符实用函数
  • html特殊字符过滤php类
  • PHP字符串特殊符号的过滤方法
  • php过滤参数特殊字符防注入
  • php 过滤非法与特殊字符串的方法
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Cadangan popular
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan
Tentang kita Penafian Sitemap
Laman web PHP Cina:Latihan PHP dalam talian kebajikan awam,Bantu pelajar PHP berkembang dengan cepat!