Ejemplo n.º 1
0
function validateStr($str, $min, $max, $type = "str", $format = "text")
{
    $_obj_v = new CLASS_VALIDATE();
    switch ($type) {
        case "str":
            $_status = $_obj_v->is_text($str, $min, $max, $format);
            //验证字符串
            break;
        case "digit":
            $_status = $_obj_v->is_digit($str, $min, $max, $format);
            //验证字符串
            break;
        case "num":
            $_status = $_obj_v->is_num($str, $min, $max);
            //验证个数
            break;
    }
    return array("str" => fn_safe($str), "status" => $_status);
}
Ejemplo n.º 2
0
function validateStr($str, $min, $max, $type = "str", $format = "text")
{
    $_obj_v = new CLASS_VALIDATE();
    switch ($type) {
        case "str":
            $_status = $_obj_v->is_text($str, $min, $max, $format);
            //验证字符串
            $str = htmlentities($str, ENT_QUOTES, "UTF-8");
            break;
        case "digit":
            $_status = $_obj_v->is_digit($str, $min, $max, $format);
            //验证字符串
            break;
        case "num":
            $_status = $_obj_v->is_num($str, $min, $max);
            //验证个数
            break;
    }
    return array("str" => $str, "status" => $_status);
}