PHP文件操作有关问题

WBOY
Release: 2016-06-13 10:18:13
Original
957 people have browsed it

PHP文件操作问题
$path = "D:\Install--Doucment\wamp\www\a.txt";

echo filesize($path);
?>

 总共就这几行代码,出现下列错误:

Warning: filesize() [function.filesize]: stat failed for D:\Install--Doucment\wamp\www\a.txt in D:\Install--Doucment\wamp\www\Practice.php on line 4

在网上也找不到类似的解决方法,不知道哪位大侠懂得里面的门道。。。先谢谢了啊

------解决方案--------------------
PHP里,应该用 dirname(__FILE__) 吧,路径应该是反斜杠 / 而不是斜杠 \
自己看 http://php.net/manual/zh/function.dirname.php
------解决方案--------------------
没有什么别的原因 路径错误,文件不存在就会出现这样的提示.
你可以将测试文件和a.txt放在一起就不会出错了.

$size=filesize('./a.php');
echo $size;


------解决方案--------------------

探讨
$path = "D:\Install--Doucment\wamp\www\a.txt";

echo filesize($path);
?>

总共就这几行代码,出现下列错误:

Warning: filesize() [function.filesize]: stat failed for D:\Install--Doucment\wamp\www\a.txt ……
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!