我正在尝试打印文本和unicode。我得到问号作为所有unicode的输出。我不想替换它,但我想显示它原来所放置的字符。有人可以告诉我如何吗? 使用PHP和具有正确符号的MySQL数据库
代码:
if (!$db) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT * FROM `XP` ORDER BY totalxp DESC";
$result = mysqli_query($db, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
printf ('<div class="user">');
printf ('<div class="content">');
printf ('<div class="profile_pic_holder">');
printf ('<img class="profile_pic" src="' . $row["profilePic"] . '" >' . "<br>");
printf ('</div><div class="text">');
# printf ("ID: " . $row["ID"] . "<br>");
printf ($row["Nickname"] . "<br>");
# printf ("UserID: " . $row["UserID"] . "<br>");
printf ("XP: " . thousandsCurrencyFormat($row["xp"]) . "<br>");
printf ("Level: " . $row["level"] . "<br>");
printf ('<div id="' . $row["UserID"] . '"></div>');
printf ('<script>$("#' . $row["UserID"] . '").progressbar({value: ' . $row["percentageToNextLvl"] . ', "ui-progressbar-overlay": "./assets/lava.gif"});</script>');
printf ("<br>");
printf ('</div>');
printf ('</div>');
printf ('</div>');
}
} else {
echo "0 results";
}
DB是数据库连接 我如何才能将昵称打印为数据库中的Unicode字符而不仅仅是问号?