How to use fgets() function to read a line from a file in PHP

1 Answer

0 votes
if ($fp = fopen('c:/xampp/htdocs/knowrex.com/index.php', 'r'))
{
    while (!feof($fp)) 
    {
         $buf = fgets($fp, 1024);
         echo $buf . "<br />";
    }
} 
else
    echo 'Error open file';  
    
fclose($fp);


/*
run:

include_once "config/global.php";

if ( isset($_GET['q']) )
{ 

...
 
*/

 



answered Apr 20, 2016 by avibootz

Related questions

...