大神求解我这哪里错了 Notice: Undefined variable: file_handle in G:\phpStudy\WWW\wwwroot\3\5.php on line 4
本地输出错误
Notice: Undefined variable: file_handle in G:\phpStudy\WWW\wwwroot\3\5.php on line 4
Notice: Undefined variable: file_handle in G:\phpStudy\WWW\wwwroot\3\5.php on line 12
Warning: fclose() expects parameter 1 to be resource, null given in G:\phpStudy\WWW\wwwroot\3\5.php on line 12
本地代码
<?php
//首先采用“fopen”函数打开文件,得到返回值的就是资源类型。
$file_handel = fopen("G:\\phpStudy\WWW\wwwroot\index.php","r");
if ($file_handle){
//接着采用while循环(后面语言结构语句中的循环结构会详细介绍)一行行地读取文件,然后输出每行的文字
while (!feof($file_handle)) { //判断是否到最后一行
$line = fgets($file_handle); //读取一行文本
echo $line; //输出一行文本
echo "<br />"; //换行
}
}
fclose($file_handle);//关闭文件
?>