2024-02-15 18:37:06 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace app\models;
|
|
|
|
|
|
|
|
use yii\base\Model;
|
|
|
|
|
|
|
|
class ZipForm extends Model
|
|
|
|
{
|
|
|
|
public $zipFilename;
|
|
|
|
public $zipFormat;
|
|
|
|
|
|
|
|
|
2024-03-26 14:40:34 +08:00
|
|
|
public function rules(): array
|
2024-02-15 18:37:06 +08:00
|
|
|
{
|
|
|
|
return [
|
|
|
|
[['zipFilename', 'zipFormat'], 'required'],
|
|
|
|
['zipFilename', 'string', 'max' => 255],
|
|
|
|
['zipFormat', 'in', 'range' => ['zip', '7z']],
|
|
|
|
['zipFilename', 'match', 'pattern' => '/^[^\p{C}\/:*?"<>|\\\\]+$/u', 'message' => 'Invalid file name.'],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2024-03-26 14:40:34 +08:00
|
|
|
public function attributeLabels(): array
|
2024-02-15 18:37:06 +08:00
|
|
|
{
|
|
|
|
return [
|
|
|
|
'zipFilename' => '压缩文件名',
|
|
|
|
'zipFormat' => '压缩格式',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|