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

后端 未结 2 1539
小蘑菇
小蘑菇 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 14:02

    You should encode the brand=Franklin&Hédgson's before creating the link, if you are generating the link with php use urlencode http://php.net/manual/en/function.urlencode.php

    Then you can use htmlentities to encode the query before sending it off to mysql in a query http://www.php.net/manual/en/function.htmlentities.php

提交回复
热议问题