GET_MAGIC_QUOTES_GPC () is the value of getting the PHP environment variable MAGIC_QUOTES_GPC. If the value is 1 o'clock, the indication is open, and if 0 o'clock, the configuration is closed!
-
GET_MAGIC_QUOTES_GPC (); The value is 1, which means open. Then PHP automatically increases the escape character "" for the parameter values that are passed by post, get, and cookie to ensure the security of the data. In particular, prevent SQL injection.
-
GET_MAGIC_QUOTES_GPC (); The value is 0, which means close. The PHP parser does not automatically add the escape character "" to the parameter values passed by post, get, or cookie, then use the Addslashes function to escape the argument.
-
GET_MAGIC_QUOTES_GPC (); not open, filter parameters with addslashes function to prevent injection sample:
<?php
$str =$_post[' str '];
if (!GET_MAGIC_QUOTES_GPC ()) {//First judgment not open
$newStr =addslashes ($STR);//Then filter with addslashes function
}
?>