[Php 4, Php 5, Php 7, Php 8]
Tệp - Nhận kích thước tệp — Gets file size
Sự mô tả
Tệp [Chuỗi $filename
]: Int | Sai[string $filename
]: int|false
Thông số
filename
Đường dẫn đến tệp.
Trả về giá trị
Trả về kích thước của tệp tính bằng byte hoặc false
[và tạo lỗi cấp độ E_WARNING
] trong trường hợp lỗi.false
[and generates an error of level E_WARNING
] in case of an error.
Lưu ý: Vì loại số nguyên của PHP được ký kết và nhiều nền tảng sử dụng số nguyên 32 bit, một số hàm hệ thống tập tin có thể trả về kết quả bất ngờ cho các tệp lớn hơn 2GB.: Because PHP's integer type is signed and many platforms use 32bit integers, some filesystem functions may return unexpected results for files which are larger than 2GB.
Errors/Exceptions
Khi thất bại, một E_WARNING
được phát ra.E_WARNING
is emitted.
Ví dụ
Ví dụ #1 Tệp [] Ví dụfilesize[] example
Ghi chú
Lưu ý: Kết quả của chức năng này được lưu trong bộ nhớ cache. Xem ClearStatCache [] để biết thêm chi tiết.: The results of this function are cached. See clearstatcache[] for more details.
Xem thêm
- file_exists [] - Kiểm tra xem tệp hoặc thư mục có tồn tại không
Rommel tại Rommelsantor Dot Com ¶ ¶
10 năm trước
Extremely simple function to get human filesize.
Ẩn danh ¶ ¶
11 năm trước
if you recently appended something to file, and closed it then this method will not show appended data:
You should insert a call to clearstatcache[] before calling filesize[]
I've spent two hours to find that =/
ivijan dot stefan tại gmail dot com ¶ ¶
5 năm trước
This function also can be great for browser caching controll. For example, you have a stylesheet and you want to make sure everyone has the most recent version. You could rename it every time you edit it, but that would be a waste of time. Instead, you can do like:
Sample output:
filename
0
filename
1
filename
2Arseny Mogilev ¶
9 năm trước
filename
3
filename
4
filename
5Damien Dussouillez ¶ ¶
5 năm trước
filename
6
filename
7
filename
8Arseny Mogilev ¶
5 năm trước
filename
9
Arseny Mogilev ¶
9 năm trước
false
0
false
1
false
2
filename
2Damien Dussouillez ¶ ¶
synnus tại gmail dot com
false
4
false
5
filename
2Arseny Mogilev ¶
synnus tại gmail dot com
false
7
false
8
filename
2Ẩn danh ¶ ¶
9 năm trước
E_WARNING
0
E_WARNING
1
synnus tại gmail dot com ¶
John Crocker ¶
E_WARNING
3
E_WARNING
4
filename
23 năm trước ¶
5 năm trước
E_WARNING
6
Arseny Mogilev ¶
5 năm trước
E_WARNING
7
E_WARNING
8
E_WARNING
9
E_WARNING
0Arseny Mogilev ¶
9 năm trước
E_WARNING
1
Damien Dussouillez ¶ ¶
11 năm trước
E_WARNING
2
E_WARNING
3
E_WARNING
4
filename
2Arseny Mogilev ¶
synnus tại gmail dot com
E_WARNING
6
E_WARNING
7
E_WARNING
8
E_WARNING
9John Crocker ¶ ¶
3 năm trước
0
1
filename
2C0NW0NK ¶ ¶
John Crocker ¶
3
4
5
6
7
8
9
Extremely simple function to get human filesize.
0
filename
23 năm trước ¶
C0NW0NK ¶
Extremely simple function to get human filesize.
2
Extremely simple function to get human filesize.
3
Extremely simple function to get human filesize.
4
Extremely simple function to get human filesize.
56 năm trước ¶
3 năm trước
Extremely simple function to get human filesize.
6
Extremely simple function to get human filesize.
7
Extremely simple function to get human filesize.
8C0NW0NK ¶ ¶
3 năm trước
Extremely simple function to get human filesize.
9
if you recently appended something to file, and closed it then this method will not show appended data:
0
You should insert a call to clearstatcache[] before calling filesize[]
I've spent two hours to find that =/
filename
2Ẩn danh ¶ ¶
11 năm trước
if you recently appended something to file, and closed it then this method will not show appended data:
2
You should insert a call to clearstatcache[] before calling filesize[]
I've spent two hours to find that =/
if you recently appended something to file, and closed it then this method will not show appended data:
3
You should insert a call to clearstatcache[] before calling filesize[]
I've spent two hours to find that =/
if you recently appended something to file, and closed it then this method will not show appended data:
4
You should insert a call to clearstatcache[] before calling filesize[]
I've spent two hours to find that =/
filename
2Arseny Mogilev ¶
synnus tại gmail dot com
if you recently appended something to file, and closed it then this method will not show appended data:
6
You should insert a call to clearstatcache[] before calling filesize[]
I've spent two hours to find that =/
if you recently appended something to file, and closed it then this method will not show appended data:
7
You should insert a call to clearstatcache[] before calling filesize[]
I've spent two hours to find that =/
filename
2John Crocker ¶ ¶
3 năm trước
if you recently appended something to file, and closed it then this method will not show appended data:
9
You should insert a call to clearstatcache[] before calling filesize[]
I've spent two hours to find that =/
This function also can be great for browser caching controll. For example, you have a stylesheet and you want to make sure everyone has the most recent version. You could rename it every time you edit it, but that would be a waste of time. Instead, you can do like:
0
This function also can be great for browser caching controll. For example, you have a stylesheet and you want to make sure everyone has the most recent version. You could rename it every time you edit it, but that would be a waste of time. Instead, you can do like:
1C0NW0NK ¶ ¶
C0NW0NK ¶
This function also can be great for browser caching controll. For example, you have a stylesheet and you want to make sure everyone has the most recent version. You could rename it every time you edit it, but that would be a waste of time. Instead, you can do like:
2
This function also can be great for browser caching controll. For example, you have a stylesheet and you want to make sure everyone has the most recent version. You could rename it every time you edit it, but that would be a waste of time. Instead, you can do like:
3
This function also can be great for browser caching controll. For example, you have a stylesheet and you want to make sure everyone has the most recent version. You could rename it every time you edit it, but that would be a waste of time. Instead, you can do like:
4
This function also can be great for browser caching controll. For example, you have a stylesheet and you want to make sure everyone has the most recent version. You could rename it every time you edit it, but that would be a waste of time. Instead, you can do like:
5Arseny Mogilev ¶
5 năm trước
This function also can be great for browser caching controll. For example, you have a stylesheet and you want to make sure everyone has the most recent version. You could rename it every time you edit it, but that would be a waste of time. Instead, you can do like:
6
Arseny Mogilev ¶
John Crocker ¶
This function also can be great for browser caching controll. For example, you have a stylesheet and you want to make sure everyone has the most recent version. You could rename it every time you edit it, but that would be a waste of time. Instead, you can do like:
7
This function also can be great for browser caching controll. For example, you have a stylesheet and you want to make sure everyone has the most recent version. You could rename it every time you edit it, but that would be a waste of time. Instead, you can do like:
8
filename
23 năm trước ¶
C0NW0NK ¶
0
Sample output:
1
Sample output:
2
Sample output:
3
Sample output:
4
Sample output:
Sample output:
56 năm trước ¶
filename
2
6
Sample output:
7
Sample output:
filename
2Chắc chắn ¶ ¶
9 năm trước
9
Sample output:
filename
00
filename
01
filename
02Damien Dussouillez ¶ ¶
5 năm trước
filename
03
filename
04
filename
2Arseny Mogilev ¶
5 năm trước
filename
06
filename
07
filename
2Arseny Mogilev ¶
5 năm trước
filename
09