gpt4 book ai didi

PHP MYSQL 编码问题(土耳其字符)

转载 作者:行者123 更新时间:2023-12-01 00:23:29 25 4
gpt4 key购买 nike

核心.php

$con=mysqli_connect("localhost","root","","mmogezgini");
header('Content-Type: text/html; charset=utf-8');

游戏列表.php

$result = mysqli_query($con,"SELECT * FROM games");
while($row = mysqli_fetch_array($result))
{
?>
HTML CODES
<?php echo $row['game_name']; ?>
HTML CODES
<?php }
mysqli_close($con);
?>

我使用像“ö,ç,ğ,ı”这样的土耳其语字符,我在数据库中正确地看到了这些字符,但是当我从数据库中选择它们并用 php echo 显示时,它们看起来像问号=(?)我在数据库 utf8_general_ci 上的编码

最佳答案

  1. 仔细检查您的 HTML 编码。
  2. > http://php.net/manual/en/mysqli.set-charset.php (就在您连接到数据库之后:mysqli_set_charset($con, 'utf8');
  3. 您是否使用准备好的语句? (无关但重要)。

关于PHP MYSQL 编码问题(土耳其字符),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19747242/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com