PHP ftell() 函數(shù)

2018-11-21 16:10 更新

PHP ftell() 函數(shù)


PHP Filesystem 參考手冊 完整的 PHP Filesystem 參考手冊

定義和用法

ftell() 函數(shù)返回在打開文件中的當前位置。

返回文件指針的當前位置,如果失敗則返回 FALSE。

語法

ftell(file)

參數(shù) 描述
file 必需。規(guī)定要檢查的已打開文件。


實例

<?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);
?>

上面的代碼將輸出:

0
15


PHP Filesystem 參考手冊 完整的 PHP Filesystem 參考手冊
以上內容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號