例子 1

<?php

$file = fopen("test.txt","r");
echo fgets($file);
fclose($file);

?>
輸出類似:
Hello, this is a test file.

例子 2
<?php

$file = fopen("test.txt","r");

while(! feof($file))
{
echo fgets($file). "<br />";
}

fclose($file);
?>
輸出類似:
Hello, this is a test file.
There are three lines here.
This is the last line.

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 stockwfj3 的頭像
    stockwfj3

    程式設計@筆記

    stockwfj3 發表在 痞客邦 留言(0) 人氣()