增加上传文件格式验证,感谢群友冷风

This commit is contained in:
巴掌 committed 2022-07-13 16:57:25 +08:00
1 parent 3213abd282
commit 24b9589416
3 files changed
+41 -1

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
<?php
declare (strict_types = 1);
namespace app\tools\validate;
use think\Validate;
class File extends Validate
{
/**
* 定义验证规则
* 格式:'字段名' => ['规则1','规则2'...]
*
* @var array
*/
protected $rule = [
'file|文件格式必须为jpg,jpeg,png,xls,xlsx' => 'fileExt:jpg,png,jpeg,xls,xlsx'
];
/**
* 定义错误信息
* 格式:'字段名.规则名' => '错误信息'
*
* @var array
*/
protected $message = [
];
}