【发布时间】:2012-01-08 17:20:36
【问题描述】:
我的系统:windos xp
我已将文件的所有权限授予所有用户。
但我无法读取文件,但我得到了文件大小,
为什么会发生这种情况,原因我无法确定。
我应该怎么做才能解决这个问题。
代码
$fileName = "1.php";
if (floatval(phpversion()) >= 4.3) {
//loading data
$fileData = file_get_contents($fileName);
print(filesize($fileName));
} else {
//if file not exist then return -3
if (!file_exists($fileName)) {
eturn -3;
}
$fp = fopen($fileName, 'r');
// if file is not open in read mode then return -2
if (!$fp) return -2;
$fileData = '';
print(filesize($fileName));
//checking end of file
while(!feof($fp))
$fileData .= fgetc($fileName);
fclose($fp);
}
echo $fileData;
【问题讨论】:
-
尝试以管理员身份启动 wamp 服务器
-
首先尝试找出错误信息是什么。
-
没有错误,没有通知,没有警告。只显示文件大小而不是内容。
-
请发布实际解析的代码...
标签: php windows-xp