2014-01-05 3 views

답변

0

예, this answer을 살펴보십시오.

$dir ="your path here"; 

$filetoread ="server_log"; 
if (is_dir($dir)) { 
    if ($dh = opendir($dir)) { 
     while (($file = readdir($dh)) !== false) { 
      if (strpos($file,$filetoread) !== false) 
      echo "filename: $file : filetype: " . filetype($dir . $file) . "\n"; 
     } 
     closedir($dh); 
    } 
} 
5

사용 glob() :

우아한 솔루션입니다
$ListFile = glob("/path/server_log_*"); 
print_r($ListFile); 
+0

이 그것에 대해 알지 못했다 :) – cgross

관련 문제