当前位置:网站首页>学习使用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);
}
调用当前方法即可过滤特殊字符,有需要可以在进行更新
边栏推荐
- 居家办公如何管理数据中心网络基础设施?
- 请问有国内靠谱低手续费的期货开户渠道吗?网上开户安全吗?
- How to improve the efficiency of network infrastructure troubleshooting and bid farewell to data blackouts?
- Handling method of Oracle data file header SCN inconsistency
- MySQL data advanced
- 为什么 JSX 语法这么香?
- Internet of things? Come and see Arduino on the cloud
- p5.js千纸鹤动画背景js特效
- Operator details
- Use of vim
猜你喜欢

About thinkphp5, use the model save() to update the data prompt method not exist:think\db\query- & gt; Error reporting solution

canvas掉落的小球重力js特效动画

How to solve multi-channel customer communication problems in independent stations? This cross-border e-commerce plug-in must be known!

NVIDIA's CVPR 2022 oral is on fire! 2D images become realistic 3D objects in seconds! Here comes the virtual jazz band!

LeetCode: 240. Search 2D matrix II

生产者/消费者模型

canvas 绘制图片

物联网?快来看 Arduino 上云啦

机器学习——感知机及K近邻

p5.js实现的炫酷交互式动画js特效
随机推荐
Jcim | AI based protein structure prediction in drug discovery: impacts and challenges
保健品一物一码防窜货营销软件开发
植物生长h5动画js特效
Troubleshooting steps for Oracle pool connection request timeout
canvas掉落的小球重力js特效动画
CICFlowMeter源码分析以及为满足需求而进行的修改
Operator details
Thinkphp5 multi language switching project practice
CVPR 2022 Oral | 英伟达提出自适应token的高效视觉Transformer网络A-ViT,不重要的token可以提前停止计算
Floating point notation (summarized from cs61c and CMU CSAPP)
Error reading CSV (TSV) file
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
上升的气泡canvas破碎动画js特效
Which of the top ten securities companies has the lowest Commission and is the safest and most reliable? Do you know anything
416-二叉树(前中后序遍历—迭代法)
机器学习——主成分分析(PCA)
[input method] so far, there are so many Chinese character input methods!
Symbol. Iterator iterator
El table Click to add row style
Why is JSX syntax so popular?