Example
ไฟล์ที่ใช้งานตัวอย่าง 192.168.2.106/usr/local/lightsquid/it.php และ it_list.php
- $path = "/usr/local/lightsquid/it/";
- $results = scandir($path);
- foreach ($results as $result) {
- if ($result != "." && $result != "..") {
- echo $result . "<br>";
- }
- }
- $dir = "/usr/local/lightsquid/it/20160727/";
- // Open a directory, and read its contents
- if (is_dir($dir)){
- if ($dh = opendir($dir)){
- while (($file = readdir($dh)) !== false){
- if (strpos($file, ':') !== false) {
- echo $file . "<br>";
- }
- }
- closedir($dh);
- }
- }
http://www.w3schools.com/php/func_directory_readdir.asp
No comments:
Post a Comment