在php.ini文件中magic_quotes_gpc = on ---- 一般情況下是on,怕用戶忘記轉義某些特殊字符。
因此,要判斷當前php的配置要取得我們想要的內容。
$gpc=get_magic_quotes_gpc(); ----返回1,magic_quotes_gpc = on,0爲off
if ($gpc==1){
$json=stripcslashes($_POST['str']); ----stripcslashes() 函數刪除由 addcslashes() 函數添加的反斜槓
}else{
$json=$_POST['strjson'];
}