PHP Export Excil Report

Source: Internet
Author: User
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

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.