Jump to content

Put all pages in a folder into an array


Gazan

Recommended Posts

<?php
$files = array ();
if ($handle = opendir('/path/to/files')) {

    while (false !== ($file = readdir($handle))) {
        if(substr($file,strlen($file)-3) == "php"){
            $files[] = $file;
        }
    }
    closedir($handle);
}
print_r($files);
?>

adapted from readdir

that should do it check the manual for more info

 

Scott.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.