当前位置:网站首页>学习使用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);
}
调用当前方法即可过滤特殊字符,有需要可以在进行更新
边栏推荐
- Tnsnames Ora file configuration
- How to standardize data center infrastructure management process
- Is there a reliable and low commission futures account opening channel in China? Is it safe to open an account online?
- Detailed explanation of ThinkPHP 5.0 Model Association
- 如何规范化数据中心基础设施管理流程
- Wechat cloud hosting launch public beta: in the appointment of the publicity meeting
- ssh远程免密登录
- 买的长期理财产品,可以转短吗?
- Queue queue
- JS singleton mode
猜你喜欢

Jcim | AI based protein structure prediction in drug discovery: impacts and challenges

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

Thinkphp5 multi language switching project practice

微信小程序學習之 實現列錶渲染和條件渲染.

Producer / consumer model

Cicflowmeter source code analysis and modification to meet requirements

如何提高网络基础设施排障效率,告别数据断档?

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

Floating point notation (summarized from cs61c and CMU CSAPP)

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
随机推荐
请问有国内靠谱低手续费的期货开户渠道吗?网上开户安全吗?
读取csv(tsv)文件出错
Practical analysis: implementation principle of APP scanning code landing (app+ detailed logic on the web side) with source code
js单例模式
新手怎么选择投资理财产品的等级?
LeetCode: 137. Number II that appears only once
SQL Server AVG函数取整问题
Engine localization adaptation & Reconstruction notes
el-table点击添加行样式
Ora-16038 ora-19502 ora-00312 troubleshooting
Analysis of 43 cases of MATLAB neural network: Chapter 32 time series prediction of wavelet neural network - short-term traffic flow prediction
Tutorial (5.0) 08 Fortinet security architecture integration and fortixdr * fortiedr * Fortinet network security expert NSE 5
Honeypot 2 hfish, ehoney
买的长期理财产品,可以转短吗?
How to solve multi-channel customer communication problems in independent stations? This cross-border e-commerce plug-in must be known!
时尚的弹出模态登录注册窗口
vim的使用
植物生长h5动画js特效
413 binary tree Foundation
Canvas draw picture