2016-02-26 54 views
0

嗨所以這是一個簡單的問題,我還發現了其他的結果和答案,但我似乎無法弄清楚,爲什麼它不剝離HTML地帶HTML

我有一個像這樣每個循環

foreach($allData[$counter]['comments'] as $comment) { 

       $sentiment = SentimentAnalysis::decision($comment); 

         //store this in the DB to have access to the information at a later stage 
         RedditComments::create([ 
         'comment' => strip_tags($comment), 
         'created' => date($allData[$counter]['created']), 
         'sentiment' => $sentiment, 
         'search_identifier' => $search_id, 
         'search_phrase' => $searchPhrase 
         ]); 
        } 

      $counter ++; 
     } 

這將使用Laravel和雄辯的數組中的每條評論存儲到數據庫中。

但它仍然保存我的這些滑稽chartacters意見,我存儲的數據看起來像這樣

<p><strong>Q:</strong> Why do you think Apple is doing this? Do you really think they're trying to hurt extension devs?</p> 

我想保存這

+1

看起來像' $ comment'已經像插入前一樣,你需要調查已經編碼的東西。一個wysiwyg編輯器?別的東西? –

回答

2

之前轉義這些<p><strong>Q:</strong>嘗試strip_tags(html_entity_decode($comment))