Home » PHP26 November 2012

PHP: Read Write File, Read Scan Directory

Here is PHP code to:
1) Read / Scan any directory
2) Read any file
3) Write to any file

1) Read or Scan directory

Get all files and folders inside the directory.
Three ways are shown below.

a) Read/Scan directory using opendir() and readdir() function

b) Read/Scan directory using scandir() function

c) Read/Scan directory using glob() function

2) Read a file using fread() function

3) Write to file using fwrite()

Thanks.

PHP

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed