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

看板PHP作者 (蘇打)時間19年前 (2006/01/08 07:16), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/3 (看更多)
※ 引述《drlai (蘇打)》之銘言: : 標題: [請益] PHP的fopen該怎麼寫入UTF-8格式? : 時間: Tue Jan 3 01:07:50 2006 : : 我想使用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 : 推 sonicjr:iconv("BIG-5","UTF-8",$string); 01/03 13:11 我嘗試修改如下 $string = "測試"; $fp = fopen("test.txt","w"); $string = iconv("BIG-5","UTF-8",$string); fwrite($fp,$string); fclose($fp); 但是結果還是一樣...輸出的檔案仍然是ANSI 我又改成 $string = utf8_encode($string);還是一樣@@" 該怎麼改才正確呢..已經修好久了都還是修不好 囧~ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.135.8.145
文章代碼(AID): #13mBmnlK (PHP)
討論串 (同標題文章)
本文引述了以下文章的的內容:
以下文章回應了本文
完整討論串 (本文為第 2 之 3 篇):
文章代碼(AID): #13mBmnlK (PHP)