我不知道这是怎么回事,但 htmlentities() 函数不起作用!
这是我所做的
(底部代码可以正常工作,但 htmlentities() 不会将引号转换为 html 代码!例如 " 应该更改为一些 html5 代码!
$term = "'" . addslashes($_GET['search_term']) . "%'";
if(!isset($term{2})){
exit();
}
$query = $db->query('SELECT customerID, fullName, dID, birthYear, homeAddress, ID, DATE_FORMAT(idIssue, "%d-%m-%Y") AS idIssue, DATE_FORMAT(idExp, "%d-%m-%Y") AS idExp, phone
FROM customers WHERE (fullName LIKE '.$term.' ) LIMIT 0,10');
while( $row = $query->fetch_assoc()){
foreach($row as $key => $value){
$arr[$key] = htmlentities(stripslashes($value), ENT_QUOTES);
}
$json[] = $arr;
}
echo json_encode($json);