Maison > php教程 > php手册 > le corps du texte

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

WBOY
Libérer: 2016-06-06 19:45:23
original
1341 Les gens l'ont consulté

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

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

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

完整代码:

<span><?php </span></span>
Copier après la connexion
<span>/**</span>
Copier après la connexion
<span>* 过滤特殊字符的函数</span>
Copier après la connexion

* edit by  www.jbxue.com

<span>*/</span>
Copier après la connexion
<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>
Copier après la connexion

 

您可能感兴趣的文章:

  • php过滤字符串函数示例
  • php正则过滤特殊字符的方法
  • php过滤特殊字符sql防注入代码
  • php特殊字符过滤综合例子
  • php过滤特殊字符实用函数
  • html特殊字符过滤php类
  • PHP字符串特殊符号的过滤方法
  • php过滤参数特殊字符防注入
  • php 过滤非法与特殊字符串的方法
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Recommandations populaires
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!