luck-draw/app/validate/Block.php

52 lines
1.6 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
// +----------------------------------------------------------------------
// | HisiPHP框架[基于ThinkPHP5开发]
// +----------------------------------------------------------------------
// | Copyright (c) 2016-2021 http://www.hisiphp.com
// +----------------------------------------------------------------------
// | HisiPHP承诺基础框架永久免费开源您可用于学习和商用但必须保留软件版权信息。
// +----------------------------------------------------------------------
// | Author: 橘子俊 <364666827@qq.com>开发者QQ群50304283
// +----------------------------------------------------------------------
namespace app\validate;
use think\Validate;
/**
* 碎片验证器
* @package app\controller\cms\validate
*/
class Block extends Validate
{
//定义验证规则
protected $rule = [
'name|别名' => [
'require',
'length' => '1,30',
'regex' => '/^[A-Za-z0-9\_]+$/',
],
'title|名称' => [
'require',
'length' => '1,20',
],
'content1|碎片内容' => [
'requireIf' => 'type,1'
],
'content2|碎片内容' => [
'requireIf' => 'type,2'
],
'content3|碎片内容' => [
'requireIf' => 'type,3'
],
'content4|碎片内容' => [
'requireIf' => 'type,4'
],
'content5|碎片内容' => [
'requireIf' => 'type,5'
],
'content6|碎片内容' => [
'requireIf' => 'type,6'
],
];
}