[Resolvido] Salvar arquivo em xls
Alguém sabe como usar esse script de modo a salvar o arquivo gerado em xls em um determinado diretório do servidor e não permitir que apareça a janela para downloads?
<?php
/*
* Criando e exportando planilhas do Excel
* http://thiagobelem.net/blog/
*/
// Definimos o nome do arquivo que será exportado
$arquivo = 'planilha.xls';
// Criamos uma tabela HTML com o formato da planilha
$html = '';
$html.='<table>';
$html.='<tr class="cabecalho">';
$html.='<td colspan="4"><h1>Lista de Inscritos</h1></td>';
$html.='</tr>';
$html.='<tr class="legenda">';
$html.='<td colspan="4"><img src="file:///C|/Users/Paulinho/Desktop/Untitled-1.png" width="300" height="35" /></td>';
$html.='</tr>';
$html.='<tr class="dados">';
$html.='<td width="154">Nº dE InscriÇÃo</td>';
$html.='<td width="591">Nome do Inscrito(a)</td>';
$html.='<td width="592">Assinatura</td>';
$html.='<td width="80">Status</td>';
$html.='</tr>';
$html.='<tr>';
$html.='<td> </td>';
$html.='<td> </td>';
$html.='<td> </td>';
$html.='<td width="80"> </td>';
$html.='</tr>';
$html.='</table>';
// Configurações header para forçar o download
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header ("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
header ("Content-type: application/x-msexcel");
header ("Content-Disposition: attachment; filename=\"{$arquivo}\"" );
header ("Content-Description: PHP Generated Data" );
// Envia o conteúdo do arquivo
echo $html;
exit;
?>Discussão (4)
Carregando comentários...