Closed AridanJohn closed 4 years ago
莫名又好了,声明验证,可以同时支持POST和GET方式吗? 但是IsInt类型,验证不了,只能换成IsString, 参数:数字取到的值全部都是string
2.0.6 type=ValidateType::GET 不需要用括号引起来
现在没有强制类型验证,后面可以考虑严格,新增一个严格模式 @JasonYH
现在没有强制类型验证,后面可以考虑严格,新增一个严格模式 @JasonYH
mongodb ,elasticsearch扩展 啥时候会上?
莫名又好了,声明验证,可以同时支持POST和GET方式吗? 但是IsInt类型,验证不了,只能换成IsString, 参数:数字取到的值全部都是string
2.0.6 type=ValidateType::GET 不需要用括号引起来
@validator 注解中 type 选项其实就是确定你验证 get还是post ,ValidateType::xx 这个类只是个预定义的标志,当然你也可以完全不用这个,直接用双引号写 'get' 或者 'body' 也是可以的。
关于你说的 IsInt 类型,其核心验证机制是使用 filter_var($value, FILTER_VALIDATE_INT)
函数进行校验的,可以允许是字符串,只要是纯数字的字符串也是可以通过校验的。
Describe the bug
参数id为int类型,采用声明验证器,@IsInt()一直提示声明message,换成@IsString()也是一样,字段参数都是不为null
参数:$uid,$touid,$p 都不为null,接口有传递参数
错误提示:参考图三,一直提示自定义的message信息,ValidateType也有引用,使用ValidateType::Body 和ValidateType::GET都是如下提示,无法通过类型验证
图4方式,提示错误: [ERROR] App\Exception\Handler\HttpExceptionHandler:handle(44) Argument 1 passed to Swoft\Validator\Helper\ValidatorHelper::validatelength() must be of the type string, integer given, called in /var/www/swoft/vendor/swoft/validator/src/Rule/LengthRule.php on line 38
Screenshots