当前位置:Gxlcms > PHP教程 > php函数get_magic_quotes_gpc

php函数get_magic_quotes_gpc

时间:2021-07-01 10:21:17 帮助过:3人阅读

  1. echo get_magic_quotes_gpc(); // 很不好意思,我的这个是0
  2. echo $_POST['lastname']; // Simao'pig
  3. echo addslashes($_POST['lastname']); // Simao\'pig

  4. if (!get_magic_quotes_gpc()) {

  5. $lastname = addslashes($_POST['lastname']);
  6. } else {
  7. $lastname = $_POST['lastname'];
  8. }

  9. echo $lastname; // Simao\'pig

  10. $sql = "INSERT INTO lastnames (lastname) VALUES ('$lastname')";
  11. ?>

人气教程排行