我有一个video的表,数据结构如下:
我利用如下程序读取表中文件,生成XML文件:include("conn.php");
include("crop.php");$xmlFile = "123.xml";
$dom = new DomDocument('1.0','utf-8');
$dom->formatOutput=true;
$thumbnails = $dom->createElement("thumbnails"); 
mysql_select_db('hdm0910283_db', $lnk) or die ('Can\'t use hdm0910283_db : ' . mysql_error());
mysql_query("SET NAMES utf-8");    
$sql="select * from video";
$query=mysql_query($sql);
while ($row = mysql_fetch_array($query)) {
//切割youku截图
$imageurl="../workshow/images/".$row[imgname];
    cutphoto("$imageurl","$imageurl",200,113);
$dom -> appendChild($thumbnails); 
    $thumbnail = $dom->createElement("thumbnail");
    $thumbnail->setAttribute('filename', $row[imgname]);
    $thumbnail->setAttribute('label', $row[title]);
    $thumbnail->setAttribute('url', $row[url]);
$thumbnails -> appendChild($thumbnail);
}
$dom->save($xmlFile);
运行的时候提示如下错误:
arning: DOMElement::setAttribute() [domelement.setattribute]: string is not in UTF-8 in D:\AppServ\www\rj\control\xml_do.php on line 20Warning: DOMDocument::save() [domdocument.save]: output conversion failed due to conv error, bytes 0xCA 0xD3 0xC6 0xB5 in D:\AppServ\www\rj\control\xml_do.php on line 24我测试过表中数据插入和读出均无问题,请高手帮助解决。XML