Read file in dir php

PHP readdir() Function

List all entries in the images directory, then close:

// Open a directory, and read its contents
if (is_dir($dir)) if ($dh = opendir($dir)) while (($file = readdir($dh)) !== false) echo «filename:» . $file . «
«;
>
closedir($dh);
>
>
?>

Definition and Usage

The readdir() function returns the name of the next entry in a directory.

Syntax

Parameter Values

Parameter Description
dir Optional. Specifies the directory handle resource previously opened with opendir(). If this parameter is not specified, the last link opened by opendir() is assumed

Technical Details

Unlock Full Access 50% off

COLOR PICKER

colorpicker

Join our Bootcamp!

Report Error

If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:

Thank You For Helping Us!

Your message has been sent to W3Schools.

Top Tutorials
Top References
Top Examples
Get Certified

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Источник

Читайте также:  Html img часть изображения
Оцените статью