Maison >développement back-end >tutoriel php >filesize函数,求解析、该怎么解决
filesize函数,求解析、
Warning: filesize() [function.filesize]: stat failed for Backup 1 of wampmanager.ini.install in D:\wamp\www\dir\dir2.php on line 10
Backup 1 of wampmanager.ini.install是文件,大小为
Warning: filesize() [function.filesize]: stat failed for Backup 1 of wampmanager.tpl.install in D:\wamp\www\dir\dir2.php on line 10
Backup 1 of wampmanager.tpl.install是文件,大小为
Warning: filesize() [function.filesize]: stat failed for Backup 2 of wampmanager.ini.install in D:\wamp\www\dir\dir2.php on line 10
Backup 2 of wampmanager.ini.install是文件,大小为
Warning: filesize() [function.filesize]: stat failed for Backup 2 of wampmanager.tpl.install in D:\wamp\www\dir\dir2.php on line 10
Backup 2 of wampmanager.tpl.install是文件,大小为
Warning: filesize() [function.filesize]: stat failed for barimage.bmp in D:\wamp\www\dir\dir2.php on line 10
barimage.bmp是文件,大小为
-----------------------------------------
用filesize($file),输出的是这些,为什么啊?Backup 1 of wampmanager.ini.install,...,barimage.bmp这些文件不能统计大小么?
------解决方案--------------------
把文件夹的路径也写上去
------解决方案--------------------
需要绝对路径吧。
我刚才测试了一下,是可以得到他的字节数的。
如果文件不存在,就会返回空。
$file_s = filesize('你的文件的绝对路径');
if(!$file_s)
$file_s = 0;
echo "
\n文件大小是=$file_s"."字节
\n";