我有这个代码来选择和显示文件夹中的所有图像:
<?php
$folder = 'sets/'.$post_year.'/'.$post_id.'/';
$filetype = '*.{jpg,jpeg,png,gif}*';
$filename = ; //Need to get the file name minus the extension
$files = glob($folder.$filetype, GLOB_BRACE);
foreach ($files as $file)
{
echo '
<div class="galleryCell">
<img class="galleryPhoto" src="photos/'.$file.'" />
<div>'.$filename.'</div>
</div>
';
}
?>
如何只获取文件名以将其显示为$filename
?