<?php
ob_start();
session_start();
require_once('./include/fun.inc.php');if( !isset($_SESSION['CrossmoAdmin']['adminName']) || empty($_SESSION['CrossmoAdmin']['adminName']))
LocateURL("admincp.php");
header("Content-type:application/vnd.ms-excel");
$FileName = date("Ymdhis");
header("Content-Disposition:attachment;filename=$FileName.xls");
$sql = "select t_admin_user.username as admin_name,
t_olebar_user.userid,
t_olebar_user.username,
t_olebar_user.lasttimestamp,
t_olebar_user.logontimes
from t_admin_user,
t_olebar_user
where t_admin_user.userid = t_olebar_user.cid
and cid > 0
order by t_admin_user.username";$table = '店员帐号明细表'; echo $table."\n\n";
//输出内容如下:
echo "用户ID"."\t";
echo "用户名"."\t";
echo "用户分公司"."\t";
echo "登陆次数"."\t";
echo "最近登陆时间\t\n";
$pq = new PageQuery();
$result = $pq->conn->GetArray($sql);
$i = 0;
foreach($result as $value)
{
$result[$i] = $value;
echo $result[$i]["userid"]."\t";
echo $result[$i]["username"]."\t";
echo $result[$i]["admin_name"]."\t";
echo $result[$i]["logontimes"]."\t";
echo $result[$i]["lasttimestamp"]."\t\n";
//echo "\n";
$i++;
}
?>现在导出的问题是这样的我所导出的数据的每一行全在第一列里面,是什么问题呢?
ob_start();
session_start();
require_once('./include/fun.inc.php');if( !isset($_SESSION['CrossmoAdmin']['adminName']) || empty($_SESSION['CrossmoAdmin']['adminName']))
LocateURL("admincp.php");
header("Content-type:application/vnd.ms-excel");
$FileName = date("Ymdhis");
header("Content-Disposition:attachment;filename=$FileName.xls");
$sql = "select t_admin_user.username as admin_name,
t_olebar_user.userid,
t_olebar_user.username,
t_olebar_user.lasttimestamp,
t_olebar_user.logontimes
from t_admin_user,
t_olebar_user
where t_admin_user.userid = t_olebar_user.cid
and cid > 0
order by t_admin_user.username";$table = '店员帐号明细表'; echo $table."\n\n";
//输出内容如下:
echo "用户ID"."\t";
echo "用户名"."\t";
echo "用户分公司"."\t";
echo "登陆次数"."\t";
echo "最近登陆时间\t\n";
$pq = new PageQuery();
$result = $pq->conn->GetArray($sql);
$i = 0;
foreach($result as $value)
{
$result[$i] = $value;
echo $result[$i]["userid"]."\t";
echo $result[$i]["username"]."\t";
echo $result[$i]["admin_name"]."\t";
echo $result[$i]["logontimes"]."\t";
echo $result[$i]["lasttimestamp"]."\t\n";
//echo "\n";
$i++;
}
?>现在导出的问题是这样的我所导出的数据的每一行全在第一列里面,是什么问题呢?
<?php
header("Content-type:application/vnd.ms-excel");
$FileName = date("Ymdhis");
header("Content-Disposition:attachment;filename=$FileName.xls");
//输出内容如下:
echo "用户ID"."\t";
echo "用户名"."\t";
echo "用户分公司"."\t";
echo "登陆次数"."\t";
echo "最近登陆时间\t\n";
?>我输出的在不同列啊