像这样使用 update_user 函数是否安全?
function update_user($update_data) {
global $pdo;
$update = array();
foreach($update_data as $field=>$data){
$update[] = '`'. $field.'` = \''. $data.'\'';
}
$query = $pdo->prepare("UPDATE users SET " . implode(', ', $update) ."WHERE user_id = " .$_SESSION['user_id']);
$query->execute();
}