$times = time();
$filename = $times.".csv";
$a = "联系人,联系电话,申请时间 ";
$days = postget("days");
$mktime = daystomktime($days);
$sql = "select * from v_tugou where ($times-times)<$mktime";
$db = new db();
$result = $db->query( $sql );
$rs = $db->fetch($result,0);
foreach($rs as $v=>$vv)
{
$a.=$vv['name'].','. $vv['mo'].",";
$a.=date('y-m-d ',$vv['times'])." ";
}
//echo $a;
$hod = fopen ($filename,"w+");
if( fwrite($hod,$a) )
{
echo "生成excel文件成功,点击<a href=$filename target=_blank>右击另存为excel文档</a>";
}
/*
数据结构
--
-- 表的结构 `hn_tugou`
--
create table if not exists `v_tugou` (
`id` int(4) not null auto_increment,
`name` varchar(20) not null default '0',
`mo` varchar(20) not null default '0',
`times` int(4) default null,
`ip` varchar(20) not null default '0',
primary key (`id`)
) engine=myisam default charset=utf8 auto_increment=2 ;
--
-- 导出表中的数据 `hn_tugou`
--
insert into `hn_tugou` (`id`, `name`, `mo`, `times`, `ip`) values
(1, 'adsense', 'www.111cn.net', 1283241159, '192.168.0.119');
本站原创文章转载注明来自http://www.111cn.net/phper/php.html
*/