PHP/MySQL - Special characters in URLs. How to avoid?

后端 未结 2 1542
小蘑菇
小蘑菇 2021-01-23 13:45

My database contains information extracted from an external feed. In this raw text feed, the following text is used in place of special characters:

& - &         


        
2条回答
  •  滥情空心
    2021-01-23 13:46

    That's because a '&' within a URL starts a new GET variable. The '?' starts your query string with has 2 items in it, 'brand' = "Franklin" and undefined = "Hédgson's".

    Here is a list of URL escape codes that you should use whenever any of those characters appear in your URL (inside a value, of course). So, the '&' needs to be escaped to '%26' when it is put into the string so that the GET will read it properly.

提交回复
热议问题