eof; if (!empty($dir['snapshot'])) { echo << eof; }else if (!empty($dir['files'])) { $first_img = array_shift($dir['files']); if (!in_array($first_img['extension'], $imgExts)) { foreach($dir['files'] as $file) { if (in_array($file['extension'], $imgExts)) { $first_img = $file; break; } } } if (in_array($first_img['extension'], $imgExts)) { echo << eof; } } echo <<{$dir['directory']} eof; } }else if (!empty($category['files'])) { //一级目录支持 foreach($category['files'] as $file) { if (!in_array($file['extension'], $imgExts)) {continue;} echo << {$file['filename']} eof; } } ?>