I already know the simple fopen for reading single file.
but i have problem.
I want to do this
I have a folder with 20 text files and it has few texts in it. and I want to make a script that will read all 20 files and echo the 2nd line into html file or in your IE broswer.
<?
// Define the full path to your folder from root
$path = "E:\web\-= php read =-";
//////////////////////////
/// how could put whole dir in this ???
$fp = @fopen("pizza.txt", "rb") or die("Couldn't open file");
while(!feof($fp))
{
$data .= fgets($fp, 1024);
}
fclose($fp);
$values = explode("\r\n", $data);
echo $values[1] . "<p>";
//////////////////////////////////
// Open the folder
$dir_handle = @opendir($path) or die("Unable to open $path");
// Loop through the files
while ($file = readdir($dir_handle)) {
if($file == "." || $file == ".." || $file == "index.php" )
continue;
echo "<a href=\"$file\">$file</a><br />";
}
// Close
closedir($dir_handle);
?>