Hướng dẫn dùng ftell c trong PHP
- Hàm ftell() dùng để trả về vị trí hiện tại của con trỏ tập tin trong một tập tin đang được mở.- Cú pháp:
- Tôi có một cây thư mục như sau:
- Phía dưới là nội dung của tập tin test.txt - Đoạn mã phía dưới là nội dung của tập tin myCode.php
- Khi đó, trên màn hình sẽ hiển thị:
Hàm Bài viết này được đăng tại freetuts.net, không được copy dưới mọi hình thức. Cú phápCú pháp: Trong đó:
Kết quả trả vềHàm sẽ trả về vị trí hiện tại của con trỏ tập tin, nếu xảy ra lỗi hàm sẽ trả về False. Bài viết này được đăng tại [free tuts .net] Ví dụVí dụ đơn giản về hàm Code $fp = fopen('test.txt', 'r+'); echo ftell($fp) ." Tham khảo: php.net - Hàm ftell() dùng để trả về vị trí hiện tại của con trỏ tập tin trong một tập tin đang được mở.- Cú pháp:
- Tôi có một cây thư mục như sau:
- Phía dưới là nội dung của tập tin test.txt - Đoạn mã phía dưới là nội dung của tập tin myCode.php
- Khi đó, trên màn hình sẽ hiển thị:
(PHP 4, PHP 5, PHP 7, PHP 8) ftell — Returns the current position of the file read/write pointer Descriptionftell(resource
Parametersstream The file pointer must be valid, and must point to a file successfully opened by fopen() or popen(). ftell() gives undefined results for append-only streams (opened with "a" flag). Return Values Returns the position of the file pointer referenced by If an error occurs, returns
ExamplesExample #1 ftell() example
See Also
Mindaugas ¶ 7 years ago
burninleo at gmx dot net ¶ 13 years ago
mbirth at webwriters dot de ¶ 16 years ago
mweierophinney at gmail dot com ¶ 17 years ago
missilesilo at gmail dot com ¶ 15 years ago
$tell === 0) php at michielvleugel dot com ¶ 17 years ago
|