<?xml version="1.0" encoding="gb2312"?>
<msg>
<E600>未知错误</E600>
<E601>验证码输入错误</E601>
<E602>此用户名已被注册</E602>
<E603>抱歉,由于系统原因,账户注册失败</E603>
<E604>登录失败:用户名或密码错误</E604>
<E605>您要浏览的帖子不存在</E605>
<E606>您要浏览的贴吧不存在</E606>
<E607>您已经申请了会员</E607>
<E608>抱歉,收件人没有找到</E608>
<E609>对不起,您没有登录,无权限进行该操作</E609>
<E610>收件人列表中有重复</E610>
<E611>对不起,您没有权限进行该操作</E611>
</msg>
<?php
session_start();
$ErrorID=$_SESSION["iError"]; # 错误代码
if ($ErrorID==""){
$ErrorID="E600";
}
$xml=simplexml_load_file("Xml/Error.xml");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>错误</title>
<link href="CSS/Text.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div>
<table width="100%" border="0">
<tr>
<td align="center"><form id="form1" name="form1" method="post" action="">
<table width="80%" border="1">
<tr>
<td height="21" align="center" bgcolor="#999999" class="Text1"><b>错误</b></td>
</tr>
<tr>
<td height="140" align="center" class="Text1"><?php echo $xml->$ErrorID; ?></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</div>
</body>
</html>
为何会乱码
==================================================
乱码,一般都是编码不统一,在读取后;尽量进行编码转换:
用的函数是:mb_convert_encoding
1、把 GBK 编码字串转换成 UTF-8 编码字串
Php代码
<?php
header("content-Type: text/html; charset=Utf-8");
echo mb_convert_encoding("你是我的好朋友", "UTF-8", "GBK");
?>
<?php
header("content-Type: text/html; charset=Utf-8");
echo mb_convert_encoding("你是我的好朋友", "UTF-8", "GBK");
?>
2、把 UTF-8 编码字串转换成 GB2312 编码字串
Php代码
// 注意将此文件存盘成 utf-8 编码格式文件再测试
<?php
header("content-Type: text/html; charset=gb2312");
echo mb_convert_encoding("你是我的好朋友", "gb312", "utf-8");
?>
// 注意将此文件存盘成 utf-8 编码格式文件再测试
<?php
header("content-Type: text/html; charset=gb2312");
echo mb_convert_encoding("你是我的好朋友", "gb312", "utf-8");
?>