Ec (2); phpclosedir function closedir (in PHP4, in PHP5) closedir-Disable directory handle report error description invalid closedir ([Resource $ dir_handle specified]) Disable directory stream dir_handle specified. The stream must be once opened opendir (). The report error parameter dir_handle specifies that the directory for processing resources is opened with opendir. If the directory handle is not specified, the most "script" ec (2); "script"
Php closedir Function
Closedir
(PHP 4 and PHP 5)
Closedir-close directory handle
Report error description
Invalid closedir ([Resource $ dir_handle specified])
Disable the directory stream dir_handle. The stream must be once opened opendir ().
Report Error Parameters
Dir_handle
The directory for processing resources was previously opened with opendir. If the directory handle is not specified, opendir () opens the assumption in the last step.
View instances
$ Dir = "/etc/php5 /";
// Open a known directory, read directory into variable and then close
If (is_dir ($ dir )){
If ($ dh = opendir ($ dir )){
$ Directory = readdir ($ dh );
Closedir ($ dh );
}
}
?>
Example
// Open the images directory
$ Dir = opendir ("images ");
// List objects in the images directory
While ($ file = readdir ($ dir ))! = False)
{
Echo "filename:". $ file ."
";
}
Closedir ($ dir );
?>
Filename :.
Filename :..
Filename: cat.gif
Filename: dog.gif
Filename: food
Filename: horse.gif