Why does php insert backslash while replacing double quotes

后端 未结 4 774
长发绾君心
长发绾君心 2021-01-21 21:10

I\'m wondering why php adds a backslash when i remove double quotes.




        
4条回答
  •  春和景丽
    2021-01-21 21:42

    See http://php.net/manual/en/security.magicquotes.php

    Magic Quotes is a process that automagically escapes incoming data to the PHP script. It's preferred to code with magic quotes off and to instead escape the data at runtime, as needed.

    When on, all ' (single-quote), " (double quote), \ (backslash) and NULL characters are escaped with a backslash automatically.

    In short, magic quotes is a feature in PHP where quote characters are automatically escaped with the \ character.

    Here are some solutions for turning off magic quotes: http://www.php.net/manual/en/security.magicquotes.disabling.php

提交回复
热议问题