[請益] 有關php的字串與mail函式

看板PHP作者 (小狼)時間18年前 (2007/11/29 18:46), 編輯推噓1(102)
留言3則, 1人參與, 最新討論串1/1
先說一下我的網頁,有一個form,裡面有textarea,post給一個php去處理 如果字串中包括了引號「"」或「'」,在php中好像會自動加上反斜線「\」 如我原本的字串是 $msg=<font color="red">; 當我echo $msg時他會自動變成 <font color=\"red\"></font> 我有google過許多方法… 不過好像都會留住那個反斜線… $data=ereg_replace("\\\'","'",$data); $data=ereg_replace('\\\"','"',$data); str_replace('\'','\\\'',$str); 等等方法 請問有沒有辦法去掉啊@@" 因為目前我碰到這個問題我是在填的時候就直接去掉html中的引號,像這樣 <font color=red></font> 不過這個方法應該不是很好吧@@" 不知道大家的想法怎麼樣? 感謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.122.118.132 ※ 編輯: SyaoranX 來自: 140.122.118.132 (11/29 18:51)

11/29 19:23, , 1F
stripslashes試過了嗎?
11/29 19:23, 1F

11/29 19:24, , 2F
還有你可以把php.ini裡的magic_quote_gpc關掉
11/29 19:24, 2F

11/29 19:24, , 3F
這選項在php5是deprecated php6就沒了
11/29 19:24, 3F
文章代碼(AID): #17JfYG9n (PHP)
文章代碼(AID): #17JfYG9n (PHP)