Ejemplo n.º 1
0
 public static function allFileList()
 {
     //此函数得到所有gif格式文件的信息
     $basePath = AppFile::appFileDir();
     $allFile = AppFile::allBaseFile($basePath);
     $i = 0;
     $valentineData = Util::loadconfig("checkResources");
     $checktypes = $valentineData['checktypes'];
     $files = array();
     while (isset($allFile[$i])) {
         if (is_dir($allFile[$i]) == false) {
             $type = pathinfo($allFile[$i], PATHINFO_EXTENSION);
             if (in_array($type, $checktypes)) {
                 $path = substr($allFile[$i], strlen($basePath));
                 $fileInfo = stat($allFile[$i]);
                 $md5 = md5_file($allFile[$i]);
                 if ($type == 'png' || $type == 'gif') {
                     $size = getimagesize($allFile[$i]);
                     $files[] = array('file' => $path, 'mtime' => $fileInfo['mtime'], 'md5' => $md5, 'type' => $type, 'width' => $size[0], 'height' => $size[1]);
                 } else {
                     $files[] = array('file' => $path, 'mtime' => $fileInfo['mtime'], 'md5' => $md5, 'type' => $type);
                 }
             }
         }
         $i++;
     }
     uasort($files, "AppFile::sortFile");
     // 生成总的MD5
     $md5String = '';
     foreach ($files as $file) {
         $md5 = $file['md5'];
         $md5String = $md5String . $md5;
     }
     $md5String = md5($md5String);
     return array($md5String, $files);
     return $allFile;
 }