转义后,数据被插入到数据库中,如下所示:
$caller=htmlentities($formVarsI['caller'], ENT_QUOTES, "UTF-8");
Run Code Online (Sandbox Code Playgroud)
一些$ caller有单引号,例如O'Connor,然后'在数据库中看起来像O Connor.
我现在尝试使用REST api提取数据,下面是我的php:
$sql = "SELECT caller FROM tbl_calls ";
try {
$db = getConnection();
$stmt = $db->query($sql);
$calls= $stmt->fetchAll(PDO::FETCH_OBJ);
$db = null;
echo json_encode($calls);
}
Run Code Online (Sandbox Code Playgroud)
我的问题是如何在$ caller上使用html_entity_decode来删除
'
Run Code Online (Sandbox Code Playgroud)
对于适用的每个呼叫者.注意有约.数据库中有10,000个条目.