0
생성 된 파일을 화면에 인쇄하는 대신 저장하려면 아래 코드를 어떻게 편집해야합니까?화면에 인쇄하는 대신 XML 파일로 내보내려면 어떻게해야합니까?
<?php
header("Content-type: text/xml");
$linkID = mysql_connect($host, $user, $pass) or die("Could not connect to host.");
mysql_select_db($database, $linkID) or die("Could not find database.");
$query = "";
$resultID = mysql_query($query, $linkID) or die("Data not found.");
$xml_output = "<?xml version=\"1.0\"?>\n";
$xml_output .= "<products>\n";
for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
$row = mysql_fetch_assoc($resultID);
$xml_output .= "\t<product>\n";
.
.
.
$xml_output .= "\t</product>\n";
}
$xml_output .= "</products>";
echo $xml_output;
?>
중복 가능성을 [강제 PHP를 사용하여 파일을 다운로드하려면] (http://stackoverflow.com/questions/1465573/forcing-to-download-a-file-using-php) –
로컬 파일에 저장하는 것을 의미하는 경우 예를 참조하십시오. http://www.tizag.com/phpT/filewrite.php – Giorgio