用PHP在MySQL数据库中插入表情智能手机?
好吧,从相当高的解释性要求来看,这只会强化这个问题 这个应用程序有一个聊天系统,可以延迟HTML,用ajax将它发送到PHP,但是高利贷者试图在数据库中插入你设备的一些表情符号(情感),他得到的信息是:“?” 我如何改变它,以便根据它的值接收每种情绪和网站列表的某种代码用PHP在MySQL数据库中插入表情智能手机?,mysql,php,Mysql,Php,好吧,从相当高的解释性要求来看,这只会强化这个问题 这个应用程序有一个聊天系统,可以延迟HTML,用ajax将它发送到PHP,但是高利贷者试图在数据库中插入你设备的一些表情符号(情感),他得到的信息是:“?” 我如何改变它,以便根据它的值接收每种情绪和网站列表的某种代码 我内心有一种沉痛的感觉,如果你使用InnoDB,你会遇到字符集问题 连接到MySQL时,运行此查询 select A.variable_name, A.variable_value global_value,
我内心有一种沉痛的感觉,如果你使用InnoDB,你会遇到字符集问题 连接到MySQL时,运行此查询
select
A.variable_name,
A.variable_value global_value,
B.variable_value session_value
from
(
select * from information_schema.global_variables
where variable_name like 'collation%'
) A
inner join
(
select * from information_schema.session_variables
where variable_name like 'collation%'
) B
using (variable_name);
我猜你会看到一个不同,尤其是与
我的建议是:使会话的值与全局值相同
select A.variable_value,B.variable_value,C.variable_value
into @coll_conn,@coll_db,@coll_srvr from
(
select * from information_schema.global_variables
where variable_name like 'collation_connection'
) A,
(
select * from information_schema.global_variables
where variable_name like 'collation_database'
) B,
(
select * from information_schema.global_variables
where variable_name like 'collation_server'
) C;
set session collation_connection = @coll_conn;
set session collation_database = @coll_db;
set session collation_server = @coll_srvr;
然后,您可以通过再次运行第一个查询来验证会话中的更改
试试看强>
注意:我之所以建议这样做,是因为上周一位开发人员向我提出了这种情况,我也进行了同样的查询。验证后,应用程序正在更改会话中的排序规则
这是一个字符集问题,而不仅仅是表情符号问题 在整个过程中使用字符集utf8mb4
- 在客户机中
- 在连接中(
或PDO等效)mysqli\u set\u charset
- 在表(或列)定义中
- html标题中的