PHP read files from directory
Posted: Wed Dec 23, 2009 4:03 am
I am trying to do a simple blog in php and i am trying to read some text files from a directory named "articles". The idea is to loop through all text files and read and post their contents:
I am totally new to PHP even though i know some other programming languages like Java, C# and C++.
Thank you!
Code: Select all
$Title="title";
$content="12435 454 25 43 543";
foreach (string file in directory)
{
//read from file
//assign file name to title
//assign file content to $content
}
//post everything on page
echo('<h2>$Title</h2>');
echo('$content');
echo('<hr>');
Thank you!