为什么这段代码不能读取文件呢

Marrylily 2008-06-26 12:03:53
<?php
$filename="D:\\mytxt\\my.txt";
$fd = fopen($filename,"r");
$contents = fread($fd,filesize($filename));
fclose($fd);
?>
...全文
72 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
lvjx125 2008-06-27
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 my_web 的回复:]
<?php
$filename="D:/mytxt/my.txt";
$fd = fopen($filename,"r");
$contents = fread($fd,filesize($filename));
fclose($fd);
?>
[/Quote]
tony-杨 2008-06-27
  • 打赏
  • 举报
回复
是否有权限读取该目录/文件呢?
lgogo 2008-06-27
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 lvjx125 的回复:]
引用 2 楼 my_web 的回复:
<?php
$filename="D:/mytxt/my.txt";
$fd = fopen($filename,"r");
$contents = fread($fd,filesize($filename));
fclose($fd);
?>
[/Quote]
my_web 2008-06-26
  • 打赏
  • 举报
回复
<?php
$filename="D:/mytxt/my.txt";
$fd = fopen($filename,"r");
$contents = fread($fd,filesize($filename));
fclose($fd);
?>
qianziai0912 2008-06-26
  • 打赏
  • 举报
回复
应该没问题阿,
你路径对吗?
echo一下,看看
或者换下别的函数看看 readfile(),fpassthru(),file()试试

21,887

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧