http://tw.php.net/manual/en/function.fopen.php
這是php網站的函數說明..
fopen("檔名","w") ... 使用w模式, 表示開啟檔案只用來寫入, 而且開啟時 刪除該檔案的全部內容
原文:
Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
fopen("檔名","a") 使用a模式, 表示開啟檔案只用來寫入(無法讀取), 並且將指標放在文件後最後面
原文:
Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
================
結論:把參數由 w 改成a...就可以直接把你要寫的內容加在文字檔後面了...
(至於要換行...請在寫入的內容加上 "\r" 或者 "\r\n" )