Heim  >  Fragen und Antworten  >  Hauptteil

php中在文件倒数140个字节的地方插入一个字符串,文件指针却一直在文件末尾

<?php
$string="haha";
$target='<input type="button" value="submit" id="submitform">';
$handle = fopen("D:/wamp/www/liuyanban.html","a");
 fseek($handle, -140,SEEK_END);
 fwrite($handle, "ok");
 fclose($handle);
?>

我想问,为什么我已经用fseek把文件指针改到倒数140个字节的地方,可是写入的时候,还是写在文件末尾的,如果这么做是错的,为什么?合理的思路是什么?

黄舟黄舟2722 Tage vor668

Antworte allen(0)Ich werde antworten

Keine Antwort
  • StornierenAntwort