Answers for "how to get file all content in php"

PHP
8

php get file contents

<?php
file_get_contents("file.txt");
?>
Posted by: Guest on May-12-2020
1

php get all txt files in directory

$path = '/path/to/directory';
$files = glob($path."/*.txt");
foreach ($files as $file) {
  echo $file;
  echo '<br>';
}
/* Outputs something like: 
	/path/to/directory/someFile.txt
	/path/to/directory/someOtherFile.txt
	/path/to/directory/anotherFile.txt
*/
Posted by: Guest on July-24-2021

Browse Popular Code Answers by Language