Php exports the csv file program. How does php export csv files? Php1_datedate(y-m-d1_1_1_filename1_date._.date(h_ I _s1_.csv; $ Tableisset ($ _ GET [tid])? $ _ GET [tid]:; $ Autoisset ($ _ POST [d])? $ _ POST [d]:; php exports csv files
$ Date = date ("Y-m-d ");
$ Filename = $ Date. '_'. date ("h_ I _s"). ". csv ";
$ Table = isset ($ _ GET ['tid'])? $ _ GET ['tid']: '';
$ Auto = isset ($ _ POST ['D'])? $ _ POST ['D']: '';
If (is_numeric ($ Auto )){
$ Table = $ Auto;
}
$ A = "user name, real name, contact information, contact QQ, contact address, email address rn ";
Header ("Content-type: application/vnd. ms-excel ");
Header ("Content-Disposition: filename =". $ Filename );
$ SQL = "Select * from gx_member ";
$ Result = mysql_query ($ SQL) or die (mysql_error ());
While ($ rs = mysql_fetch_array ($ Result )){
If (get_days ($ rs ['m _ time']) <= $ Table ){
$. = $ Rs ['m _ name']. ','. $ rs ['m _ realname']. ",". $ rs ['m _ tel ']. ",". $ rs ['m _ QQ']. ",";
$ A. = "". $ rs ['m _ address']. ",". $ rs ['m _ mail']. "rn ";
}
}
Echo $;
Function get_days ($ base ){
$ Date_1 = date ("Y-m-d"); // The format can also be: $ Date_1 = "23:29:14 ";
$ Date_2 = substr ($ base, 0, 10 );
$ Date_List_a1 = explode ("-", $ Date_1 );
$ Date_List_a2 = explode ("-", $ Date_2 );
// Print_r ($ Date_List_a2 );
$ D1 = mktime (0, 0, 0, $ Date_List_a1 [1], $ Date_List_a1 [2], $ Date_List_a1 [0]);
$ D2 = mktime (0, 0, 0, $ Date_List_a2 [1], $ Date_List_a2 [2], $ Date_List_a2 [0]);
// Echo round ($ d1-$ d2)/3600/24 ),'
';
Return round ($ d1-$ d2)/3600/24 );
}
?>
For original site reprinted, please indicate www.111cn.cn/phper/php.html
Http://www.bkjia.com/PHPjc/630429.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/630429.htmlTechArticlephp export csv file program? Php $ Date = date (Y-m-d); $ Filename = delimiter; $ Table = isset ($ _ GET ['tid'])? $ _ GET ['tid']: ''; $ Auto = isset ($ _ POST ['D'])? $ _ POST ['D']: '';...