查看單個文章
舊 2009-03-06, 10:49 AM   #4 (permalink)
cwvdavid
長老會員
 
cwvdavid 的頭像
榮譽勳章
UID - 476
在線等級: 級別:46 | 在線時長:2395小時 | 升級還需:2小時級別:46 | 在線時長:2395小時 | 升級還需:2小時級別:46 | 在線時長:2395小時 | 升級還需:2小時級別:46 | 在線時長:2395小時 | 升級還需:2小時級別:46 | 在線時長:2395小時 | 升級還需:2小時級別:46 | 在線時長:2395小時 | 升級還需:2小時
註冊日期: 2002-12-06
住址: 天與地的夾縫
文章: 3106
精華: 0
現金: 5256 金幣
資產: 2034465 金幣
預設

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" )
__________________
姜太公釣魚~ 願者上鉤
cwvdavid 目前離線  
送花文章: 4036, 收花文章: 2466 篇, 收花: 10141 次
回覆時引用此帖
有 3 位會員向 cwvdavid 送花:
kppne0931 (2009-05-20),magicwoo (2009-03-12),飛行船大大 (2009-03-10)
感謝您發表一篇好文章