PHP头条
热点:

utf8_encode()与utf8_decode函数


utf8_encode() 函数把 iso-8859-1 字符串编码为 utf-8。

utf8_encode(string);
*/
$str="你好,世界!";        //定义字符串
$result=utf8_decode($str);      //进行编码转换
echo $result;         //输出转换结果


//实例二

/*
utf8_decode() 函数把 utf-8 字符串解码为 iso-8859-1。

该函数把用 utf-8 方式编码的 iso-8859-1 字符串转换成单字节的 iso-8859-1 字符串。

如果成功,该函数将返回解码字符串;否则返回 false。

utf8_decode(string)

*/

$str="hello world!";        //定义字符串
$result=utf8_decode($str);      //进行编码转换
echo $result;
$result=utf8_encode($result);      //进行编码转换
echo $result;         //输出转换结果
?>

www.phpzy.comtrue/php/28073.htmlTechArticleutf8_encode()与utf8_decode函数 utf8_encode() 函数把 iso-8859-1 字符串编码为 utf-8。 utf8_encode(string); */ $str=你好,世界!;//定义字符串 $result=utf8_decode($str);//进行编码转换 echo $result;//输出转换结果...

相关文章

    暂无相关文章

PHP之友评论

今天推荐