我想检查存储器上可用的空间,我在其中存储用户的附件。我去了disk_free_space()
和disk_total_space()
。其结果是:php disk_total_space()减去disk_free_space()不等于占用空间
自由空间:5.47 GB
总面积:5.86 GB
所以占用的空间= 0.39 GB。
我也通过这些文件循环以获得它们的大小filesize()
。总共文件占用18.34 GB。 (最大文件大小为4 MB,所以在PHP手册中关于2GB不会注意的说明适用)
所以:
总面积 - 自由空间=占用的空间
为什么?
文件系统位于HP-UX上。我使用同一个帐户测量了所有的值 - 通过使用互联网浏览器执行脚本,我运行了php脚本中的所有命令。
我也检查了Windows中的函数。结果是确定的。
我通过相关的功能(How to get the disk space on a server?,How to determin how much space is freeon your server? (php),How to detect the server space enough for the uploaded file or no?,How to get the disk space on a server?,Is it possible to get special Local Disk information from PHP?,php disk_total_space)一些其他的问题去了,但没有找到答案。
我认为ü系统有一些分区,请尝试disk_free_space('/ home /')和disk_total_space('/ home /') – Sergey 2012-07-10 10:37:52
@Sergey谢谢。他们都返回了'0'。 – bostaf 2012-07-10 10:50:07