1
如何獲得沒有文件擴展名的文件? 目前我收到一個像logo.png
這樣的文件,但我只需要文件名logo
。沒有文件擴展名的Scandir
if (is_dir($dir_path)) {
$files = scandir($dir_path);
foreach($files as $file) {
if (!in_array($file, $exclude_all)) {
$path_to_file = $dir_path . $file;
$extension = pathinfo ($path_to_file, PATHINFO_EXTENSION);
$file_url = $dir_url . $file;
echo 'Path to file: ' . $path_to_file . '<br />';
echo 'Extension: ' . $extension . '<br />';
echo 'URL: ' . $file_url . '<br />';
}
}
}