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
0
Views
123
Replies
1
Views
79
Recommended Threads
Replies
1
Views
2,313
Replies
1
Views
2,551
Replies
12
Views
3,471
Replies
15
Views
7,583

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