php获取文件夹中文件名称

php获取文件夹中文件名称

public function get_file_list(){

  $file_list = [];

  $file_path = resource_path('views\home');

  if (is_dir($file_path)){

    $handler = opendir($file_path);

    while( ($filename = readdir($handler)) !== false ) {
      if($filename != "." && $filename != ".."){
        $file_list[] = $filename;
      }
    }
    closedir($handler);

    return $file_list;

  }
}

猜你喜欢

转载自www.cnblogs.com/haoxuanchen2014/p/9636493.html