Home  >  Article  >  Backend Development  >  How to add and remove backslashes before quotation marks in PHP

How to add and remove backslashes before quotation marks in PHP

WBOY
WBOYOriginal
2016-07-25 08:57:451460browse
  1. $str=$_POST["str"];//Read the content of str and assign it to the $str variable
  2. if(get_magic_quotes_gpc())//If get_magic_quotes_gpc() is turned on
  3. {
  4. $str=stripslashes($str);//Process the string
  5. }
Copy the code

After modification, the PHP program tested normally both locally and on the website. Related Reading : How to add backslash before php quotes (remove backslash in PHP)



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn