P & lt; p & gt; & lt ;? Phpecho get_magic_quotes_gpc (); // detect, output 0 echo & lt;/p & gt; & lt; tiny_marker & gt;/p & gt; -
- & lt; p & gt; post [' name']; // jason'name
- echo addslashes(
tiny_mce_marker
POST['name']); // jason'name
- if (!get_magic_quotes_gpc()) {
- $name = addslashes(
tiny_mce_marker
POST['name']);
- } else {
- $name =
tiny_mce_marker
POST['name'];
- }
- echo $name; //jason'name
- //Safely written to the database
- ?>
-
-
-
- Copy code
-
-
In the following example, both functions are processed.
if(version_compare(PHP_VERSION,'6.0.0','<') ) {@set_magic_quotes_runtime (0); define('MAGIC_QUOTES_GPC',get_magic_quotes_gpc()?True: False);- }
-
-
- Copy code
-
-
In addition, you can also use ini_get and ini_set to read and set the system configuration:
!ini_get('magic_quotes_runtime') && ini_set('magic_quotes_runtime', 0); //Auto-escape function is off
|