我对 php 和第一个项目非常陌生,但我遇到了这种错误:
注意:未定义的变量:第 16 行 C:\wamp\www\mysite\includes\functions.php 中的 magic_quotes_active
这是我的代码;
function mysqli_prep($value) {
$magic_quotes_activen = get_magic_quotes_gpc();
$new_enough_php = function_exists( "mysqli_real_escape_string");
// i.e PHP >= V4.3.0
if ($new_enough_php ) {// PHP V4.3.0 or higher
// undo any magic quote effects so mysqli_real_escape_string can
// do the work
if( $magic_quotes_active ) {$value = stripslashes($value);}
$value = mysqli_real_escape_string($value);
} else {//before PHP V4.3.0
// if magic quotes aren't already on then add slashes manually
if(!$magic_quotes_active) { $value = addslashes($value);}
// if magic quoes are active, then the slashes already exist
}
return $value;