php fseek ftell

<?php
header('Content-Type: text/html; charset=utf-8');
$file = './php34.txt';   // ./php34.txt 里面的内容:01234567890
$mode = 'r+';
$file_handle = fopen($file, $mode);


echo '<br>', ftell($file_handle);  //0
fseek($file_handle, 3);//该函数把文件指针从当前位置向前或向后移动到新的位置,新位置从文件头开始以字节数度量。
echo '<br>', ftell($file_handle);//3
echo '<br>', fgets($file_handle, 3);//34

 

posted on 2017-07-18 06:45  huodaihao  阅读(144)  评论(0编辑  收藏  举报

导航