為了防止亂碼,我在為db設罷了好幾個字元集:
<code> mysqli_query($db,"SET NAMES UTF8"); mysqli_query($db,"set character_set_client=utf8"); mysqli_query($db,"set character_set_connection=utf8"); mysqli_query($db,"set character_set_results=utf8");</code>
不過看到一篇文章是這麼說的:
http://zhangxugg-163-com.iteye.com/blog/1835721
按上面的描述,一條SET NAMES UTF8
是不是就已經等於set character_set_client=utf8; set character_set_connection=utf8; set character_set_results=utf8;
大家討論下
<code> mysqli_query($db,"SET NAMES UTF8"); mysqli_query($db,"set character_set_client=utf8"); mysqli_query($db,"set character_set_connection=utf8"); mysqli_query($db,"set character_set_results=utf8");</code>
不過看到一篇文章是這麼說的:
http://zhangxugg-163-com.iteye.com/blog/1835721
按上面的描述,一條
SET NAMES UTF8是不是就已經等於set character_set_client=utf8; set character_set_connection=utf8; set character_set_results=utf8;
大家討論下.`
<code>set NAMES utf8 show variables like "character_set_%"</code>
操作顯示是這樣的
如上回答,改變了character_set_client/character_set_connection/character_set_results三個值 是的,一條指令等於你所列的3條,主要確保編碼一致性不亂碼