Answers for "get file data php"

PHP
7

php get file contents

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

read file data using php

<?php

$fh = fopen('filename.txt','r');
while ($line = fgets($fh)) {
  // <... Do your work with the line ...>
  // echo($line);
}
fclose($fh);
?>
Posted by: Guest on July-19-2021
0

take file data in variable php

ob_start();

include "yourfile.php";

$myvar = ob_get_clean();

reference :
https://stackoverflow.com/questions/1272228/how-do-i-load-a-php-file-into-a-variable
https://secure.php.net/manual/en/function.ob-get-clean.php
Posted by: Guest on February-17-2021

Browse Popular Code Answers by Language