我只是把我一直在开发的网站放在网上,发现我所有人都强调了#34; e" (该网站是法语)显示为问号。我做了快速搜索并添加了
<meta charset="UTF-8">
<meta http-equiv="Content-type" content="text/html; charset=UTF-8">
但错误仍然存在。
正在从数据库加载文本,这是其结构的图片:
有问题的字段是&#34;描述&#34;正如你所看到的,我选择了utf8进行整理。我无法帮助,但请注意,在显示行统计信息的表格中,它显示为latin_swedish。不确定它是否与它有关。谢谢你的帮助。
选择说明的代码:
<?php include 'db_connect.php';
$modelID = mysqli_real_escape_string($connect,$_GET['m']); // Model ID, passed through URL
$query = mysqli_query($connect,"SELECT * FROM models WHERE id = ".$modelID);
if (mysqli_num_rows($query)==0) echo "Nothing found.<br/>";
while ($q = mysqli_fetch_array($query)) {
$picMain = $q['picture_url'];
$description = $q['description'];
$picDir = $q['picDir'];
}
// Create an array of images to pass to jQuery
$diaporama = array();
if ($handle = opendir('Images/'.$picDir)) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != ".." && $entry != ".DS_Store") {
array_push($diaporama,$entry);
}
}
closedir($handle);
}
$randomPicID = array_rand($diaporama,1);
$randomPic = $picDir.$diaporama[$randomPicID];
$substring = substr($randomPic, 0, -5);
?>
<script type="text/javascript" src="JavaScript/general.js"></script>
<div id="GuitarBigWindow">
<div id="leftWindow" style="background-image: url('Images/<?php echo $picMain; ?>'); ">
<a href="notalink.html" id="infoButton">+ Information</a>
<div id="info" class="notVisible"><?php echo $description; ?></div>
</div>
<div id="rightWindow" style="background-image: url('Images/<?php echo $randomPic; ?>');"
onclick="
var enable = function() { counter++;
if (counter > 7) {counter = 1;}
$( '#rightWindow' ).css('background-image', 'url(Images/<?php
echo $substring;
?>' + counter + '.jpg)');}
enable();
this.style.pointerEvents = 'none';
$( '#rightWindow' ).on('transitionend',
function(e) {
this.style.pointerEvents = 'auto';
});
clearInterval(interval);
automatic();
"></div>
答案 0 :(得分:0)
一般来说,可能的原因很少:
SET NAMES ...
- 一次设置3个不同的内容)答案 1 :(得分:0)
建立数据库连接后,尝试添加
$db_connection->set_charset("utf8");
(其中$db_connection
代表您的连接)