怎么读取自己电脑的文件
<?php
//首先采用“fopen”函数打开文件,得到返回值的就是资源类型。
$file_handle = fopen("C:/Users/Administrator/Desktop/test.txt","r");
if ($file_handle){
//接着采用while循环(后面语言结构语句中的循环结构会详细介绍)一行行地读取文件,然后输出每行的文字
while (!feof($file_handle)) { //判断是否到最后一行
$line = fgets($file_handle); //读取一行文本
echo $line; //输出一行文本
echo "<br />"; //换行
}
}
fclose($file_handle);//关闭文件
?>提示错误
Warning: fopen(C:\Users\Administrator\Desktop\test.txt): failed to open stream: No such file or directory in /54/754/MXSR/index.php on line 3
Warning: fclose() expects parameter 1 to be resource, boolean given in /54/754/MXSR/index.php on line 12