Hướng dẫn disk_free_space php - disk_free_space php

Hàm disk_free_space() sẽ trả về thông tin về số bộ nhớ còn trống tính bằng byte của hệ thống chứa đường dẫn hoặc ổ đĩa bất kì được truyền vào.

Hướng dẫn disk_free_space php - disk_free_space php

Hướng dẫn disk_free_space php - disk_free_space php

Bài viết này được đăng tại freetuts.net, không được copy dưới mọi hình thức.freetuts.net, không được copy dưới mọi hình thức.

Cú pháp

Cú pháp: disk_free_space( $directory);disk_free_space( $directory);

Trong đó::

  • $directory là đường dẫn tới file, thư mục hoặc ổ đĩa muốn kiểm tra.

Kết quả trả về

Hàm sẽ trả về số byte còn trống của hệ thống nếu thành công, ngược lại nếu thất bại hàm trả về False.False.

Bài viết này được đăng tại [free tuts .net]

Ví dụ

Một số ví dụ về hàm disk_free_space():

Code

echo $df = disk_free_space("C:/xampp\htdocs") . "
"; echo $df_c = disk_free_space("C:") . "
"; echo $df_d = disk_free_space("D:") . "
";

Kết quả


62932115456

Tham khảo: php.net

(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)

disk_free_space — Returns available space on filesystem or disk partitionReturns available space on filesystem or disk partition

Description

disk_free_space(string $directory): float|false(string $directory): float|false

Parameters

directory

A directory of the filesystem or disk partition.

Note: :

Given a file name instead of a directory, the behaviour of the function is unspecified and may differ between operating systems and PHP versions.

Return Values

Returns the number of available bytes as a float or false on failure. false on failure.

Examples

Example #1 disk_free_space() exampledisk_free_space() example

// $df contains the number of bytes available on "/"
$df disk_free_space("/");// On Windows:
$df_c disk_free_space("C:");
$df_d disk_free_space("D:");
?>

Ghi chú

Lưu ý: Hàm này sẽ không hoạt động trên các tệp từ xa vì tệp cần được kiểm tra phải có thể truy cập thông qua hệ thống tệp của máy chủ.: This function will not work on remote files as the file to be examined must be accessible via the server's filesystem.

Wiede tại gmx dot net ¶

11 năm trước


62932115456
0


62932115456
1


62932115456
2

Ẩn danh ¶

8 năm trước


62932115456
3


62932115456
4


62932115456
5


62932115456
6


62932115456
7


62932115456
2

Sam ¶

13 năm trước


62932115456
9

disk_free_space()0

disk_free_space()1

disk_free_space()2

disk_free_space()3


62932115456
2

Nitơ ¶

15 năm trước

disk_free_space()5

disk_free_space()6

disk_free_space()7


62932115456
2

Jawira Bồ Đào Nha ¶

8 tháng trước

disk_free_space()9

một cái gì đó ¶

5 năm trước

disk_free_space( $directory);0

Matthieu s ¶

5 năm trước

disk_free_space( $directory);1

disk_free_space( $directory);2


62932115456
2

Matthieu s ¶

Pavel tại Sunhater Dot Com ¶

disk_free_space( $directory);4

disk_free_space( $directory);5

disk_free_space( $directory);6