标签: php fread
我想阅读来自txt文件的信件,但只能从第5到第6(2个字母)
<? $myFile = "administrator/data.txt"; $fh = fopen($myFile, 'r'); $theData = fread($fh, 4); fclose($fh); ?>
此代码读取前4个数字,但我不知道如何选择第5至第6个字母的字母。
答案 0 :(得分:3)
首先使用fseek将文件指针前进到所需位置。
... fseek($fh, 5); $theData = fread($fh, 2); ...