fopen的第二个参数:<?php
// 如果文件不可读取或者不存在,fopen 函数返回 FALSE
$file = @fopen("dd", "r");
// fopen:打开文件或者 URL
//resource fopen ( string $filename , string $mode [, bool $use_include_path [, resource $zcontext ]] )
// 来自 fopen 的 FALSE 会发出一条警告信息并在这里陷入无限循环
if(!is_resource($file)) die("this is null");
echo "is go on";
while (!feof($file)) {
echo fgets($file);//从文件指针中取出一行。
//fgets:从 handle 指向的文件中读取一行并返回长度最多为 length - 1 字节的字符串。碰到换行符(包括在返回值中)、EOF 或者已经读取了 length - 1 字节后停止(看先碰到那一种情况)。如果没有指定 length,则默认为 1K,或者说 1024 字节。
//出错时返回 FALSE。
//echo 11;
echo "<br>";
}
fclose($file);//关闭一个已经打开的文件指针
----------------------------