Re: [請益] php 字串寫入檔案
函數 int fwrite(int fp, string string, int [length])
~~~~~~
這個要放 int fp , 而不是 string filename
寫入檔案的步驟:
1. 開啟檔案
$fp = fopen($myFile, 'a');
fopen後返回到一個 Resource_id , 基本上是用這個id來操作.
(類似 mysql_connect() -> 也會返回 Resouce_id )
2. 寫入資料
fwrite( $fp , $myString);
3. 關閉檔案
fclose($fp);
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 203.73.254.130
推
04/13 21:29, , 1F
04/13 21:29, 1F
討論串 (同標題文章)
完整討論串 (本文為第 2 之 3 篇):