yii index.php
ini_set("display_errors", 1);
iconv这个函数不能直接用 需要检测!!!
function gb2312_utf8($str = ""){
if(function_exists("iconv")){
return iconv("gb2312", "utf-8//IGNORE", $str);
}else
if(function_exists("mb_convert_encoding")){
return mb_convert_encoding($str,
‘UTF-8‘, "gb2312");
}else{
die(‘gb2312_utf8 occur error!‘);
}
}
function utf8_gb2312($str = ""){
if(function_exists("iconv")){
return iconv("utf-8",
"gb2312//IGNORE", $str);
}else
if(function_exists("mb_convert_encoding")){
return mb_convert_encoding($str,
‘gb2312‘, "UTF-8");
}else{
die(‘utf8_gb2312 occur error!‘);
}
}