30 lines
655 B
PHP
30 lines
655 B
PHP
|
<?php
|
||
|
|
||
|
namespace app\models;
|
||
|
|
||
|
use yii\base\Model;
|
||
|
|
||
|
class ZipForm extends Model
|
||
|
{
|
||
|
public $zipFilename;
|
||
|
public $zipFormat;
|
||
|
|
||
|
|
||
|
public function rules()
|
||
|
{
|
||
|
return [
|
||
|
[['zipFilename', 'zipFormat'], 'required'],
|
||
|
['zipFilename', 'string', 'max' => 255],
|
||
|
['zipFormat', 'in', 'range' => ['zip', '7z']],
|
||
|
['zipFilename', 'match', 'pattern' => '/^[^\p{C}\/:*?"<>|\\\\]+$/u', 'message' => 'Invalid file name.'],
|
||
|
];
|
||
|
}
|
||
|
|
||
|
public function attributeLabels()
|
||
|
{
|
||
|
return [
|
||
|
'zipFilename' => '压缩文件名',
|
||
|
'zipFormat' => '压缩格式',
|
||
|
];
|
||
|
}
|
||
|
}
|