Heim > Artikel > Backend-Entwicklung > mysql读取数据后编码有问题,求高手
smarty 编码 数据库 MySQL
function charsetUTF8($params) { extract($params); $str=iconv("gb2312","UTF-8",$text); return $str; }$smarty->register_function("Util", "charsetUTF8");
{section name=gro_id loop=$gro} <option value="{$gro[gro_id].id}">{Util text=$gro[gro_id].u_group}</option> {/section}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
echo charsetUTF8($params); 这里乱码吗