PHP Export Excil Table
PHP Export Excel format file (xls), just add a file header to the PHP file, filename is the exported XLS file name, when you click on the URL of this file, you will be prompted to download the XLS file
Header ("Content-type:application/vnd.ms-execl");
Header ("content-disposition:attachment; Filename=info.xls ");
Header ("Pragma:no-cache");
Header ("expires:0");
Example:
Header ("Content-type:application/vnd.ms-execl");
Header ("content-disposition:attachment; Filename=info.xls ");
Header ("Pragma:no-cache");
Header ("expires:0");
Require_once (DirName (__file__). " /.. /include/config_base.php ");
Require_once (DirName (__file__). " /.. /dede/config.php ");
Require_once (DirName (__file__). " /.. /include/pub_datalist.php ");
$dsql = new Dedesql (false);
echo "Subscription Date". " \ t ";
echo "Subscription content". " \ t ";
echo "Name". " \ t ";
$dsql->setquery ("select * from ' TableName ' ORDER by ' ID ' desc");
$dsql->execute ();
$i = 1;
while ($row = $dsql->getarray ()) {
echo $row [' Utime ']. " \ t ";
echo $row [' Ucont ']. " \ t ";
echo $row [' UName ']. " \ t ";
$i + +;
}?>
2014-04-04
From the Baidu Space migration