2014-05-15 31 views
0

我保存编辑日志的txt文件,我的问题是 如何呼应/显示所有可用的日志/ txt文件在日志目录(PHP)显示可用的文本文件

IM已经取得功能读取文件

function readFile($filename) { 
    $myfile = fopen("$filename", "r") or die("Unable to open file!"); 
    // Output one line until end-of-file 
    while(!feof($myfile)) { 
     echo fgets($myfile) . "<br>"; 
    } 
    fclose($myfile);  
} 

上面的代码只是功能ReadFile的,我的问题是节目可用的文件,感谢

+1

['glob'](http://php.net/glob)可能会有所帮助。 –

+0

谢谢,我会读那 –

回答

2

您正在寻找使用opendir()DirectoryIterator类。

Stack Overflow上的类似问题。

PHP script to loop through all of the files in a directory?

应该让你在正确的方向前进。

+0

这应该是一个投票结束重复,只是让你知道;) –

+0

不知道..谢谢:) –

+0

PS:不知道我们可以做到这一点..漂亮新的SO,再次感谢。 –