<?phpinclude("conn.php");include("crop.php");mysql_select_db('hdm0910283_db', $lnk) or die ('Can\'t use hdm0910283_db : ' . mysql_error());mysql_query("SET NAMES gbk"); $sql="select * from video";$query=mysql_query($sql);$str="<thumbnails>";while ($row = mysql_fetch_array($query)) { //echo $row[imgname]; $imageurl="../workshow/images/".$row[imgname]; cutphoto("$imageurl","$imageurl",200,113); $str=$str."<thumbnail filename=\"".$row[imgname]."\" label=\"".$row[title]."\" url=\"".$row[url]. "\"/>"; //echo $row[imgname];}header("content-type:text/html; charset=utf-8"); //指定PHP使用UTF-8编码$xml = simplexml_load_file("../workshow/xml/thumbnails.xml"); //读取xml文件$str = $xml->asXML(); //标准化$xml$fp = fopen("../workshow/xml/thumbnails.xml", "w"); //新建xml文件fputs($fp, $str); //写入-------xml文件fclose($fp);?>
<?xml version="1.0"?><thumbnails><thumbnail filename="136421249467911.jpg" label="铁军-纪念长春净月高新区城市管理行政执法局成立" url="http://v.youku.com/v_show/id_XNTI5NzU4MzEy.html"/><thumbnail filename="136421346392337.jpg" label="那一年 这一年-同学会纪念" url="http://v.youku.com/v_show/id_XNTI5NjEwMzMy.html"/><thumbnail filename="136421349294580.jpg" label="松原粮食集团有限公司" url="http://v.youku.com/v_show/id_XNTI5Njk2MzQ0.html"/><thumbnail filename="136421354756516.jpg" label="生态 魅力 和谐 长白山" url="http://v.youku.com/v_show/id_XNTI5Njg1OTEy.html"/><thumbnail filename="136421359617912.jpg" label="南郡水云天3号" url="http://v.youku.com/v_show/id_XNTI5NjcyMDM2.html"/><thumbnail filename="136421362461256.jpg" label="吉林省松原农业高新技术开发区" url="http://v.youku.com/v_show/id_XNTI5NjAwNzQw.html"/><thumbnail filename="136421365264950.jpg" label="长春兴隆综合保税区" url="http://v.youku.com/v_show/id_XNTI5NTg4MDI0.html"/></thumbnails>
循环中
$str=$str."
$str = $xml->asXML();
那么,缓存的查询结果不就被覆盖了吗?