php处理提交字符串的函数,彻底杜绝各种攻击。
/** * 字符串处理,主要处理html字符
* @param string $str
* @param bool $flip 处理http提交参数使用false,从数据库读出来展示到页面使用true
* @return string */
function doStr($str, $flip = false){
if (!$str) { return $str; }
if ($flip) {
$str = htmlspecialchars_decode($str);
if (version_compare(PHP_VERSION, '7.2.34', '<')) {
!get_magic_quotes_gpc() $str = stripslashes($str);
} else {
$str = stripslashes($str);
}
} else {
if (version_compare(PHP_VERSION, '7.2.34', '<')) {
!get_magic_quotes_gpc()$str = addslashes($str);
} else {
$str = addslashes($str);
}
$str = htmlspecialchars($str);
}
return $str;
}
未经允许不得转载:任鹏个人博客 » php处理提交字符串的函数,彻底杜绝各种攻击
最新评论
Forex wiki. https://lt.forex-stock-bitcoin-brokers.com
Magnificent items from you, man. I have take note your stuff
Following on from the 3rd March Meetings held by economic de
It is remarkable, rather valuable message dfgdlfg2131.32
一般都会有一个沙盒期的,过了沙盒期就会慢慢放出来
百度不收录是应为是新站的原因吗?
The spike in consumer prices that left inflation at a four-d