Can I read content on files in a directory by PHP?

yunarel

Member
Registered
Joined
Oct 13, 2014
Messages
33
Points
0
Hello Guys,

Can you give me your PHP codes on how can I read about 300 files in a folder named "myfol" and I want to read content on each file and print the result to screen.

Please suggest me simplest way.

Thank you in advance for your help
 

Hassan

Well-known member
Registered
Joined
Nov 11, 2014
Messages
433
Points
0
Code:
foreach(glob("$myDirectory/*") as $file) {
    echo nl2br(file_get_contents($file));
}
 
Newer Threads
Latest Threads
Replies
1
Views
24
Replies
0
Views
176
Replies
1
Views
37
Replies
2
Views
81
Recommended Threads

Latest postsNew threads

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top