mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-02 05:02:48 +08:00
改进Validate类 支持静态调用 可用于单独的验证规则
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user