ÒÔÏÂÊÇÔÚLinuxÏÂͨ¹ýApache+PHP¶ÔMysqlÊý¾Ý¿âµÄ±¸·ÝµÄÎļþ´úÂ룺
ÎļþÒ»¡¢Listtable.php £¨ÎļþÁгöÊý¾Ý¿âÖеÄËùÓбí¸ñ£¬¹©Ñ¡Ôñ±¸·Ý£©
ÇëÑ¡ÔñÒª±¸·ÝµÄ±í¸ñ:
$con=mysql_connect('localhost','root','xswlily');
$query="select * from $table ";
//Êý¾Ý¿â²éѯ
$result=mysql_db_query("embed",$query,$con);
$filestr="<"."?xml version=\"1.0\" encoding=\"GB2312\"?".">";
$filestr.="<".$table."s>";
while ($row=mysql_fetch_array($result))
//ÁгöËùÓеļǼ
{$filestr.="<".$table.">";
$fields=mysql_list_fields("embed",$table,$con);
$j=0;
//$num_fields=mysql_field_name($fields,$j);
//echo $num_fields;
while ($j
$num_fields=mysql_field_name($fields,$j);
$filestr.="<".$num_fields.">";
$filestr.=$row[$j];
$filestr.="";
$j++;}
$filestr.="";
}
$filestr.="";
echo $filestr;
//ÒÔÏÂÊÇÎļþ²Ù×÷´úÂë
$filename=$table.".xml";
$fp=fopen("$filename","w");
fwrite($fp,$filestr);
fclose($fp);
Echo "Êý¾Ý±í".$table."ÒѾ±¸·Ý³É¹¦£¡";?>
ͨ¹ýÒÔÉÏÎļþµÄ²Ù×÷¾Í¿ÉÒÔʵÏÖ¶ÔÊý¾Ý¿âÖÐÑ¡¶¨µÄ±í¸ñ½øÐб¸·Ý.
ÒÔÉÏÖ÷Òª½éÉÜÁËͨ¹ýPHPʵÏÖXML±¸·ÝÊý¾Ý¿âµÄ²Ù×÷·½·¨£¬Æäʵ²¢²»¸´ÔÓ£¬Í¨¹ýXML£¬ÎÒÃÇ¿ÉÒÔ±¸·Ý¸÷ÖÖ¸÷ÑùµÄÊý¾Ý¿â£¬µ±È»Ò²¿ÉÒÔͨ¹ýÏà¹ØµÄ·½·¨½«±¸·ÝµÄXMLÎĵµ»Ö¸´µ½Êý¾Ý¿âÖУ¬ÕâÀï¾Í²»ÏêϸÃèÊöÁË¡£