你可以使用PHP的disk_total_space()
和disk_free_space()
函数获取磁盘容量和可用空间。
disk_total_space()
函数返回指定路径的磁盘总空间(以字节为单位),例如:
$total_space = disk_total_space("/");
echo "Total disk space: " . $total_space . " bytes";
disk_free_space()
函数返回指定路径下磁盘的可用空间(以字节为单位),例如:
$free_space = disk_free_space("/");
echo "Free disk space: " . $free_space . " bytes";
你可以将上面的路径"/"
替换为你自己的适用路径。