echo get_magic_quotes_gpc(); // 很不好意思,我的这个是0 echo $_POST['lastname']; // Simao'pig echo addslashes($_POST['lastname']); // Simao\'pig if (!get_magic_quotes_gpc()) { $lastname = addslashes($_POST['lastname']); } else { $lastname = $_POST['lastname']; } echo $lastname; // Simao\'pig $sql = "INSERT INTO lastnames (lastname) VALUES ('$lastname')"; ?> 复制代码