【发布时间】:2010-04-03 22:09:31
【问题描述】:
从 .php 文件读取 .txt 文件时,fread() 函数无法工作(不显示错误)有什么原因吗?
代码
$file = fopen("db.php","rw");
$data = fgets($file, filesize("db.php"));
echo($data);
fclose($file);
die();
【问题讨论】:
-
.php文件是纯文本文件,所以应该没有区别。你试过file_get_contents吗?另外,引用文档:Note: If you just want to get the contents of a file into a string, use file_get_contents() as it has much better performance than the code above. -
我只是尝试使用它,没有运气:(
-
@tarnfield,你能发布代码吗?你永远不知道...
-
右键>查看html源码。我敢打赌你的数据就在那里......
-
@chris cl.ly/H3d ?为什么这个..只有