改进Validate类 支持静态调用 可用于单独的验证规则

This commit is contained in:
thinkphp
2016-06-04 11:59:16 +08:00
parent e9b60d1e4d
commit 150a3fe190

View File

@@ -11,6 +11,7 @@
namespace think;
use think\Exception;
use think\Input;
use think\Request;
@@ -1107,4 +1108,14 @@ class Validate
}
return $scene;
}
public static function __callStatic($method, $params)
{
$class = new static;
if (method_exists($class, $method)) {
return call_user_func_array([$class, $method], $params);
} else {
throw new Exception(__CLASS__ . ':' . $method . ' method not exist');
}
}
}