Home Backend Development PHP Tutorial PHP disk_free_space() function and disk_total_space() function description

PHP disk_free_space() function and disk_total_space() function description

Jul 11, 2017 am 09:18 AM
disk free space

disk_free_space — Returns the free space in the directory

Description

 disk_free_space ( $directory )
Copy after login

Gives a string containing a directory , this function will return the number of available bytes based on the corresponding file system or disk partition.

Parameters directory

File system directory or disk partition.

Note:

If a file name is specified instead of a file directory, the behavior of this function will not be uniform and will vary depending on the operating system and PHP version.

Return value

Returns the number of available bytes in floating point, or FALSE on failure.

disk_free_space() Example

<?php
// $df 包含根目录下可用的字节数
$df  =  disk_free_space ( "/" );

//在 Windows 下:
$df_c  =  disk_free_space ( "C:" );
$df_d  =  disk_free_space ( "D:" );
?>
Copy after login

Note: This function cannot be used on remote files. The file being checked must be accessible through the server's file system.

disk_total_space — Returns the total disk size of a directory

Description

disk_total_space ( $directory )
Copy after login

gives a character containing a directory String, this function will return all bytes according to the corresponding file system or disk partition. [Translator's Note] This function returns the total size of the disk partition where the directory is located, so the results obtained by giving different directories of the same disk partition as parameters are exactly the same. Mounting a disk partition as a subdirectory is supported in both Unix and Windows 200x/XP, in which case it makes sense to use this function correctly.

Parameters

directory The directory or disk partition of the file system.

Return value

Returns the total disk size of a directory in bytes in floating point, or FALSE on failure.

disk_total_space() Example

<?php
// $df 包含 "/" 目录的磁盘大小
$ds  =  disk_total_space ( "/" );

//在 Windows 下:
$ds  =  disk_total_space ( "C:" );
$ds  =  disk_total_space ( "D:" );
?>
Copy after login

Note: This function cannot be used on remote files. The files being checked must be accessible through the server's file system.

The above is the detailed content of PHP disk_free_space() function and disk_total_space() function description. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

ChatGPT now allows free users to generate images by using DALL-E 3 with a daily limit ChatGPT now allows free users to generate images by using DALL-E 3 with a daily limit Aug 09, 2024 pm 09:37 PM

DALL-E 3 was officially introduced in September of 2023 as a vastly improved model than its predecessor. It is considered one of the best AI image generators to date, capable of creating images with intricate detail. However, at launch, it was exclus

Where is the space key on your computer? Where is the space key on your computer? Feb 22, 2023 am 10:15 AM

The computer space key is at the bottom of the keyboard; the space key is the space bar, or blank key, which is a key on the computer keyboard; the space key is usually a long bar. The main reason for using this design is that it can easily enter spaces, such as in Two words are usually separated by a space, so the space bar is designed to be wider than any other key, allowing the thumbs of both hands to hit the space bar easily.

LEGO bricks constructed from meteorite dust, test run for a moon base LEGO bricks constructed from meteorite dust, test run for a moon base Jun 28, 2024 am 07:25 AM

It is hard to imagine that the building materials for a planned lunar base would first have to be transported to Earth's satellite at great expense. After all, every pound counts when launching from the Earth's surface. The problem is the lunar regol

ghost installation tutorialdisk ghost installation tutorialdisk Feb 12, 2024 am 11:00 AM

For computer repairmen, system enthusiasts, network administrators, and colleagues who often install and maintain systems, ghost software is very familiar to everyone! Ghost software can install the system, backup the system, restore the system, copy data, copy the entire hard disk, etc. Today, let’s learn how to use this software in detail: 1. This is the initial interface for opening the ghost software, click OK to enter. 2. Introduction to the functions of the ghost main interface. 3. Introduction to common functions of ghost. Local→Disk (operate on the entire hard disk) Local→Disk→ToDisk hard disk to hard disk (copy) →ToImage: hard disk to mirror (backup) →FromImage hard disk from mirror (restore) Loc

Deepin V23 RC2 arrives with tweaks galore and optimizations aplenty Deepin V23 RC2 arrives with tweaks galore and optimizations aplenty Jun 28, 2024 am 07:45 AM

The AI-enabled Deepin Linux distro has just received its latest update, dubbed V23 RC2. This version of Deepin comes with a number of package updates and new features. But it's not all about the features; the look and feel are the main spotlight of t

What are the advanced uses of the free command in Linux? What are the advanced uses of the free command in Linux? Feb 20, 2024 am 09:18 AM

In Linux systems, the free command is an important system tool used to monitor system memory usage. It provides basic usage to view information such as total memory, used amount, and available amount. In addition, there are some advanced uses, such as displaying detailed memory information, unit conversion, and real-time monitoring of memory. Basic usage of the free command: The basic syntax of the free command is as follows: free [options] Here are some commonly used options: -h: Display the memory size in a human-readable manner. -b: Display memory size in bytes. -k: Display memory size in kilobytes. -m: Display memory size in megabytes. -g: Display memory size in gigabytes. Sample Code: Let’s go through the sample code

How to use the free command in linux How to use the free command in linux May 13, 2023 pm 06:01 PM

In Linux, free is a built-in command to check the memory usage status. It can display the usage of system physical memory, virtual memory (swap partition), shared memory and system cache. The syntax is "free [option]"; the output of the free command Very similar to the memory part of the top command. Linuxfree command: Check the memory usage status The free command is used to display the system memory status, including the usage of system physical memory, virtual memory (swap partition), shared memory and system cache. Its output is very similar to the memory part of the top command. The basic format of the free command is as follows: #free [options] Table 1 lists the commonly used options of this command and their respective meanings. Table 1f

Deal | Samsung gives away free Odyssey G3 gaming monitors with 44%-off Odyssey G9 and Ark OLED and mini-LED displays Deal | Samsung gives away free Odyssey G3 gaming monitors with 44%-off Odyssey G9 and Ark OLED and mini-LED displays Sep 13, 2024 pm 03:15 PM

Samsung's Odyssey G9 gaming monitor range offers some of the best — and most expensive— high-refresh OLED and mini-LED gaming monitors around. Fortunately, a current sale on Samsung's site has brought those exorbitant prices down by as much as 46%. T

See all articles