2012-04-29 253 views

回答

2

我想你應該看看PHP globhttp://php.net/manual/en/function.glob.php

示例:搜索dir/module和子目錄live.php或任何與live.php

glob_recursive('dir/module/*live.php'); 

函數結束使用:http://www.php.net/manual/en/function.glob.php#106595

if (! function_exists('glob_recursive')) 
{ 
    function glob_recursive($pattern, $flags = 0) 
    { 
     $files = glob($pattern, $flags); 
     foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) 
     { 
      $files = array_merge($files, glob_recursive($dir.'/'.basename($pattern), $flags)); 
     } 
     return $files; 
    } 
} 
+0

a絕對是根據需要....謝謝你爸爸 – shuja 2012-04-29 17:59:14

相關問題