protected function checkSize() { $size = $this->instance->size; if ($this->size < $size) { //如果上传的文件大于允许的文件大小 $this->addError('size', '上传的文件大小超过了' . $this->size . 'KB'); return false; } else { return true; } }