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.
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 partition — Returns 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
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
629321154560
629321154561
629321154562
Ẩn danh ¶ ¶
8 năm trước
629321154563
629321154564
629321154565
629321154566
629321154567
629321154562
Sam ¶ ¶
13 năm trước
629321154569
disk_free_space[]
0
disk_free_space[]
1
disk_free_space[]
2
disk_free_space[]
3
629321154562
Nitơ ¶ ¶
15 năm trước
disk_free_space[]
5
disk_free_space[]
6
disk_free_space[]
7
629321154562
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
629321154562
Matthieu s ¶ ¶
Pavel tại Sunhater Dot Com ¶
disk_free_space[ $directory];
4
disk_free_space[ $directory];
5
disk_free_space[ $directory];
6