- 分享
- 0
- 人气
- 0
- 主题
- 7
- 帖子
- 4707
- UID
- 82675
- 积分
- 5108
- 阅读权限
- 22
- 注册时间
- 2007-6-18
- 最后登录
- 2021-7-27
- 在线时间
- 5767 小时
  
|
原帖由 宅男-兜着走 于 2009-7-29 09:59 PM 发表 
<?PHP
$file_handle = fopen("title.txt", 'rb');
while (!feof($file_handle) ) {
$line_of_text = fgets($file_handle);
$stringData.= $line_of_text . "\n";
}
$stringData.= "new text document" . "\n";
fclose($file_handle);
$file_handle = fopen("title.txt" , 'w');
if (fwrite($file_handle, $stringData)){
echo "insert successfully";
}
else{
echo "not insert";
}
fclose($file_handle);
?>
为什么 output 是
new text documentnew text document
连在一起的, 但是读出来的时候却可以有 new text document
new text document 分开的呢?
1. 不明白你所指的 output 是哪部分??
2. 讀取時候又是在哪??
3. $stringData.= $line_of_text . "\n"; 沒必要加上 newline, 這是多餘的 |
|