SoFunction
Updated on 2025-04-09

php disk_free_space Returns the directory available space

usage

disk_free_space($path);

Note: This function cannot act on remote files, and the files being checked must be accessed through the server's file system.

Functions of this function

This function will return the available number of bytes based on the corresponding file system or disk partition

OK, the example is very simple, let’s take a look at the examples.
Copy the codeThe code is as follows:

<?php
$jb51net = disk_free_space("/");
echo $jb51net;
?>


Copy the codeThe code is as follows:

<?php
// $df contains the number of bytes available in the root directory
$df = disk_free_space("/");
//Under Windows:
disk_free_space("C:");
disk_free_space("D:");
?>

Returns the file system or disk partition to return the number of available bytes