📜  php代码示例中的fgets

📅  最后修改于: 2022-03-11 14:53:58.900000             🧑  作者: Mango

代码示例1
$fptr =  fopen('myfile.txt','r'); 
    if(!$fptr) 
    { 
        die("Could not open file"); 
    } 
    while($line = fgets($fptr)) 
    { 
        echo $line; //fgets read line by line, if we don't put code in while loop then it will print only one line of code
    } 
    echo "End of the file reached!";  //it only reads one line at a time