removing strange characters from php string

前端 未结 14 926
忘了有多久
忘了有多久 2021-01-31 17:45

this is what i have right now

Drawing an RSS feed into the php, the raw xml from the rss feed reads:

Paul’s Confidence

The ph

相关标签:
14条回答
  • 2021-01-31 18:35

    Read up on http://us.php.net/manual/en/function.html-entity-decode.php

    That & symbol is a html code so you can easily decode it.

    0 讨论(0)
  • 2021-01-31 18:35

    Super simple solution is to have the characters decoded when the page is loaded

    Simply copy/paste the following at the beginning of the script

     header('Content-Type: text/html; charset=UTF-8');
    
     mb_internal_encoding('UTF-8');  
     mb_http_output('UTF-8'); 
     mb_http_input('UTF-8');  
     mb_regex_encoding('UTF-8');
    

    Reference: http://php.net/manual/en/function.mb-internal-encoding.php comment left by webfav at web dot de

    0 讨论(0)
提交回复
热议问题