欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

各位看看代码哪里错误了

程序员文章站 2022-04-26 19:36:24
...
$coon=mysqli_connct($host,$useranme,$password,$db);
mysqli_query($conn,"set names utf8");

foreach ($_POST as $key => $value) {
$_POST[$key] = mysqli_real_escape_string($conn,str_replace("\","\",$value));
}
foreach ($_GET as $key => $value) {
$_GET[$key] = mysqli_real_escape_string($conn,htmlspecialchars ($value,ENT_QUOTES,'UTF-8'));
}

回复内容:

$coon=mysqli_connct($host,$useranme,$password,$db);
mysqli_query($conn,"set names utf8");

foreach ($_POST as $key => $value) {
$_POST[$key] = mysqli_real_escape_string($conn,str_replace("\","\",$value));
}
foreach ($_GET as $key => $value) {
$_GET[$key] = mysqli_real_escape_string($conn,htmlspecialchars ($value,ENT_QUOTES,'UTF-8'));
}

各位看看代码哪里错误了
这个地方的斜线会转义后面的双引号的吧

相关标签: php mysql mysqli