$txt = '好人一生平安';
echo encoding($txt);
$txt = '好人一生平安';
echo decoding($txt);
#gb2312、utf8、HTML-ENTITIES
function encoding($str){
return mb_convert_encoding($str, 'HTML-ENTITIES', 'utf8');
}
function decoding($str){
return mb_convert_encoding($str, 'utf8','HTML-ENTITIES');
}