$value) { $_POST[$key] = mysqli_real_escape_string($conn,str_replace("","",..."/> $value) { $_POST[$key] = mysqli_real_escape_string($conn,str_replace("","",...">

首页  >  文章  >  后端开发  >  各位看看代码哪里错误了

各位看看代码哪里错误了

WBOY
WBOY原创
2016-06-06 20:32:201341浏览

$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'));
}

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

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn