当前位置:网站首页>学习使用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);
}
调用当前方法即可过滤特殊字符,有需要可以在进行更新
边栏推荐
- [custom endpoint and implementation principle]
- JCIM|药物发现中基于AI的蛋白质结构预测:影响和挑战
- 分布式 | 如何与 DBLE 进行“秘密通话”
- MySQL data advanced
- Canvas draw picture
- Ora-16038 ora-19502 ora-00312 troubleshooting
- 上升的气泡canvas破碎动画js特效
- 英伟达这篇CVPR 2022 Oral火了!2D图像秒变逼真3D物体!虚拟爵士乐队来了!
- 二叉树第一部分
- Wechat cloud hosting launch public beta: in the appointment of the publicity meeting
猜你喜欢

Go language development environment setup +goland configuration under the latest Windows

LeetCode: 240. Search 2D matrix II

Development of anti fleeing marketing software for health products

Ora-28000 error after upgrading Oracle 12C to 19C

How to improve the efficiency of network infrastructure troubleshooting and bid farewell to data blackouts?

Operator details

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

机器学习——主成分分析(PCA)

微信小程序学习之 实现列表渲染和条件渲染.

Impdp leading schema message ora-31625 exception handling
随机推荐
Recursive traversal of 414 binary tree
SVG+js拖拽滑块圆形进度条
Programming questions (continuously updated)
Symbol.iterator 迭代器
p5.js实现的炫酷交互式动画js特效
Network of test and development - Common Service Protocols
桌面软件开发框架大赏
[custom endpoint and implementation principle]
PostgreSQL DBA quick start - source compilation and installation
linux下oracle服务器打开允许远程连接
413 binary tree Foundation
416 binary tree (first, middle and last order traversal iteration method)
Operator details
Endgame P.O.O
Symbol. Iterator iterator
How does home office manage the data center network infrastructure?
Graffiti smart brings a variety of heavy smart lighting solutions to the 2022 American International Lighting Exhibition
保健品一物一码防窜货营销软件开发
二叉樹第一部分
Use of vim