选择语言 :

 Core_HttpIO::sanitize

对字符串进行安全处理

null Core_HttpIO::sanitize( $str $str )

参数列表

参数 类型 描述 默认值
$str $str
File: ./core/classes/httpio.class.php
public static function sanitize($str)
{
    if (null === $str) return null;
    if (is_array($str) || is_object($str))
    {
        $data = array();
        foreach ($str as $k => $v)
        {
            $data[$k] = HttpIO::sanitize($v);
        }
    }
    else
    {
        $str = trim($str);
        if (strpos($str, "\r") !== false)
        {
            $str = str_replace(array("\r\n", "\r"), "\n", $str);
        }
        $data = htmlspecialchars($str);
    }
    return $data;
}