我想将 excel 导出到特定文件夹,用户可以将其保存在他们想要的任何地方。目前我已经成功导出到 excel 但我在本地对其进行了测试并将其下载到我的本地服务器文件夹中。我希望有一个人可以帮助我。谢谢你。
$id=$_GET['id'];
$excel=new ExcelWriter("./excel/company".$id.".xls");
if($excel==false)
echo $excel->error;
$myArr=array("NO", "COMPANY", "ADDRESS1", "ADDRESS2", "ADDRESS3", "POSTCODE", "CITY", "STATE", "PHONE NO", "FAX NO", "EMAIL", "WEBSITE");
$excel->writeLine($myArr);
$qry=mysql_query(" SELECT organizations.*, states.state, cities.city FROM organizations, states, cities WHERE idOrg='$id' AND organizations.state_id=states.idState AND organizations.city_id=cities.idCity");
if($qry!=false)
{
$i=1;
while($res=mysql_fetch_array($qry))
{
$myArr=array($i,$res['companyName'], $res['add1'], $res['add2'], $res['add3'], $res['postcode'], $res['city'],$res['state'], $res['phoneNo'], $res['faxNo'], $res['email'], $res['website']);
$excel->writeLine($myArr);
$i++;
}
}