当前位置:网站首页>学习使用php对字符串中的特殊符号进行过滤的方法
学习使用php对字符串中的特殊符号进行过滤的方法
2022-06-24 09:40:00 【徊忆羽菲】
学习使用php对字符串中的特殊符号进行过滤的方法
过滤方法
function filtrationStr($str){
$str = str_replace('`', '', $str);
$str = str_replace('·', '', $str);
$str = str_replace('~', '', $str);
$str = str_replace('!', '', $str);
$str = str_replace('!', '', $str);
$str = str_replace('@', '', $str);
$str = str_replace('#', '', $str);
$str = str_replace('$', '', $str);
$str = str_replace('¥', '', $str);
$str = str_replace('%', '', $str);
$str = str_replace('^', '', $str);
$str = str_replace('……', '', $str);
$str = str_replace('&', '', $str);
$str = str_replace('*', '', $str);
$str = str_replace('(', '', $str);
$str = str_replace(')', '', $str);
$str = str_replace('(', '', $str);
$str = str_replace(')', '', $str);
$str = str_replace('-', '', $str);
$str = str_replace('_', '', $str);
$str = str_replace('——', '', $str);
$str = str_replace('+', '', $str);
$str = str_replace('=', '', $str);
$str = str_replace('|', '', $str);
$str = str_replace('\\', '', $str);
$str = str_replace('[', '', $str);
$str = str_replace(']', '', $str);
$str = str_replace('【', '', $str);
$str = str_replace('】', '', $str);
$str = str_replace('{', '', $str);
$str = str_replace('}', '', $str);
$str = str_replace(';', '', $str);
$str = str_replace(';', '', $str);
$str = str_replace(':', '', $str);
$str = str_replace(':', '', $str);
$str = str_replace('\'', '', $str);
$str = str_replace('"', '', $str);
$str = str_replace('“', '', $str);
$str = str_replace('”', '', $str);
$str = str_replace(',', '', $str);
$str = str_replace(',', '', $str);
$str = str_replace('<', '', $str);
$str = str_replace('>', '', $str);
$str = str_replace('《', '', $str);
$str = str_replace('》', '', $str);
$str = str_replace('.', '', $str);
$str = str_replace('。', '', $str);
$str = str_replace('/', '', $str);
$str = str_replace('、', '', $str);
$str = str_replace('?', '', $str);
$str = str_replace('?', '', $str);
return trim($str);
}
调用当前方法即可过滤特殊字符,有需要可以在进行更新
边栏推荐
- p5.js千纸鹤动画背景js特效
- How do novices choose the grade of investment and financial products?
- Oracle database expdp only exports tables
- 微信小程序学习之 实现列表渲染和条件渲染.
- 411 stack and queue (20. valid parentheses, 1047. delete all adjacent duplicates in the string, 150. inverse Polish expression evaluation, 239. sliding window maximum, 347. the first k high-frequency
- 买的长期理财产品,可以转短吗?
- 物联网?快来看 Arduino 上云啦
- canvas管道动画js特效
- 新手怎么选择投资理财产品的等级?
- Thinkphp5 multi language switching project practice
猜你喜欢

SSH Remote Password free login

利用pandas读取SQL Sever数据表

Practical analysis: implementation principle of APP scanning code landing (app+ detailed logic on the web side) with source code

p5.js千纸鹤动画背景js特效

415 binary tree (144. preorder traversal of binary tree, 145. postorder traversal of binary tree, 94. inorder traversal of binary tree)

Groovy obtains Jenkins credentials through withcredentials

nVisual数字基础设施运营管理软件平台

Queue queue

413 binary tree Foundation

操作符详解
随机推荐
Amendment to VPP implementation policy routing
机器学习——感知机及K近邻
How to improve the efficiency of network infrastructure troubleshooting and bid farewell to data blackouts?
js代理模式
p5.js千纸鹤动画背景js特效
Wechat cloud hosting launch public beta: in the appointment of the publicity meeting
PostgreSQL
Endgame P.O.O
ByteDance Interviewer: talk about the principle of audio and video synchronization. Can audio and video be absolutely synchronized?
物联网?快来看 Arduino 上云啦
简单的价格表样式代码
Mise en œuvre du rendu de liste et du rendu conditionnel pour l'apprentissage des applets Wechat.
Graffiti smart brings a variety of heavy smart lighting solutions to the 2022 American International Lighting Exhibition
SQL Server AVG函数取整问题
Groovy obtains Jenkins credentials through withcredentials
About thinkphp5, use the model save() to update the data prompt method not exist:think\db\query- & gt; Error reporting solution
Five heart matchmaker
分布式 | 如何与 DBLE 进行“秘密通话”
SQL-统计连续N天登陆的用户
2021-08-17