Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

验证器BUG及建议优化 #53

Closed
angel-wangchuan opened this issue Mar 28, 2020 · 1 comment
Closed

验证器BUG及建议优化 #53

angel-wangchuan opened this issue Mar 28, 2020 · 1 comment
Labels
bug Something isn't working enhancement New feature or request

Comments

@angel-wangchuan
Copy link

angel-wangchuan commented Mar 28, 2020

BUG:
验证器, @integer 方式验证数据存在漏洞,传字符串也可以验证通过;

建议优化:
现在的验证器,功能不是很好用,希望添加下 验证场景 方式验证参数,可以借鉴下TP的验证方式
以下是TP5.1的验证方式
class Tencent extends Validate {
// 验证参数
protected $rule = [
'num' => 'require',
'content' => 'require'
];
// 验证错误文案
protected $message = [
'num.require' => 'num不能为空',
'content.require' => '内容不能为空'
];
// 验证tag
protected $scene = [
'postOften' => ['num','content']
];
}
$validate = new Tencent;
$validate->scene('postOften')->check($data);

@angel-wangchuan angel-wangchuan changed the title 建议优化下验证器 验证器BUG及建议优化 Mar 29, 2020
Yurunsoft added a commit that referenced this issue Mar 30, 2020
@Yurunsoft Yurunsoft added bug Something isn't working enhancement New feature or request labels Mar 30, 2020
@Yurunsoft
Copy link
Member

问题已经修复,场景验证也已支持,具体可以查看文档:https://doc.imiphp.com/components/validation/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants