PHP ftell () ฟังก์ชัน
ความหมายและการใช้งาน
ftell () ฟังก์ชันส่งกลับตำแหน่งปัจจุบันในแฟ้มเปิด
ผลตอบแทนที่ได้ตำแหน่งปัจจุบันของตัวชี้แฟ้มบนความล้มเหลวกลับ FALSE
ไวยากรณ์
ftell(file)
参数 | 描述 |
---|---|
file | 必需。规定要检查的已打开文件。 |
ตัวอย่าง
<?php
$file = fopen("test.txt","r");
// print current position
echo ftell($file);
// change current position
fseek($file,"15");
// print current position again
echo "<br />" . ftell($file);
fclose($file);
?>
$file = fopen("test.txt","r");
// print current position
echo ftell($file);
// change current position
fseek($file,"15");
// print current position again
echo "<br />" . ftell($file);
fclose($file);
?>
รหัสข้างต้นส่งออกจะ:
0
15
15
เสร็จสมบูรณ์คู่มือการใช้งานระบบแฟ้ม PHP อ้างอิง