[請益] PHP的fopen該怎麼寫入UTF-8格式?

看板PHP作者 (蘇打)時間20年前 (2006/01/03 01:06), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/3 (看更多)
我想使用fopen來建立utf-8編碼的檔案 但我不知道該怎麼設定... $string = "測試"; $fp = fopen("test.txt","w"); fwrite($fp,$string); fclose($fp); 這樣會是ANSI而非utf-8.. 那如果想讓他出來的檔案格式為utf-8該怎作呢?用iconv嗎? 感謝^^" -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.135.8.145

01/03 13:11, , 1F
iconv("BIG-5","UTF-8",$string);
01/03 13:11, 1F
文章代碼(AID): #13kLr-Ve (PHP)
文章代碼(AID): #13kLr-Ve (PHP)