gpt4 book ai didi

php - mysql/php 的 UTF8 问题

转载 作者:行者123 更新时间:2023-11-29 09:01:02 24 4
gpt4 key购买 nike

我有一个 mysql 表,其中包含一些导入的数据,特别是一个值是 Sinn Féin

我的数据库使用的字符集是utf8_general_ci 。数据在 phpMyAdmin 中显示良好。在我的网站中,我使用了 PHP header header("Content-type: text/html; charset='utf-8'"); 。我有<meta http-equiv="Content-type" content="text/html; charset=utf-8" />在我的<head> .

我的数据仍然显示为 Sinn F�in 。我尝试过使用 utf8_decode ,但这没有帮助。我做错了什么?

最佳答案

mysql_connect()之后添加以下行:

mysql_query ("SET NAMES utf8");

关于php - mysql/php 的 UTF8 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8616656/

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