初始化代码
This commit is contained in:
36
application/admin/validate/Message.php
Normal file
36
application/admin/validate/Message.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Message extends Validate
|
||||
{
|
||||
/**
|
||||
* 定义验证规则
|
||||
* 格式:'字段名' => ['规则1','规则2'...]
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
||||
protected $rule = [
|
||||
'title' => 'require',
|
||||
'content' => 'require',
|
||||
];
|
||||
|
||||
/**
|
||||
* 定义错误信息
|
||||
* 格式:'字段名.规则名' => '错误信息'
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [
|
||||
'title.require' => '标题必须',
|
||||
'content.require' => '内容必须',
|
||||
];
|
||||
|
||||
protected $scene = [
|
||||
'adminAdd' => ['title', 'content'],
|
||||
'adminEdit' => ['title', 'content'],
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user