Remove encoding using PHP

前端 未结 3 2069
星月不相逢
星月不相逢 2021-02-13 18:02

I have the following text:

We%27re%20proud%20to%20introduce%20the%20Amazing

I\'d like to remove the encoding using PHP, but using html_en

3条回答
  •  伪装坚强ぢ
    2021-02-13 18:41

    This encoding is called Percent encoding or URL encoding. In PHP you have rawurlencode, rawurldecode for “raw” URL encoding as well as the urlencode and urldecode for the slightly different encoding that is used in the query (rather known as application/x-www-form-urlencoded where the space is encoded with + instead of %20).

    In your case the “raw” URL encoding is used. So try rawurldecode to decode it:

    rawurldecode('We%27re%20proud%20to%20introduce%20the%20Amazing')
    

提交回复
热议问题