<?php
// 列出一个文件下的所有文件名。
function listDirFile($Dirpath){

    if($dir = opendir($Dirpath)){

        while(($file = readdir($dir)) !== false){

            if( !is_dir($Dirpath.$file)){

                echo "filename: $file<br>";

            }
        }

    }

}

listDirFile('home/some_fff/');

 

<?php
//  获取文件的后缀名
function getExtension($filename){ 
$myext = substr($filename, strrpos($filename, '.')); 

  return str_replace('.','',$myext); 

}
$filename='sf.doc';
echo getExtension($filename);
?>

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-25
  • 2022-12-23
  • 2022-12-23
  • 2021-06-09
  • 2021-07-17
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2022-12-23
  • 2021-08-29
  • 2022-02-27
相关资源
相似解决方案