protected function validateFileIsImage(File $file) { $errors = array(); $info = image_get_info($file->getFileUri()); if (!$info || empty($info['extension'])) { $errors[] = "只运行上传JPG、PNG、GIF格式的图片文件。"; } return $errors; }