• 欢迎使用 天下第一网店
  • 设为首页】【加入收藏
主页 > ECShop > 外部系统整合 >

导出ecshop数据为xsl格式的方法

来源:www.china1store.com 作者:天下第一网店 发表于:2010-12-12 11:37  点击:
如果想搬把ecshop中的一些数据给导成xls格式,可以使用以下这段代码,非常好用。

  如果想搬把ecshop中的一些数据给导成xls格式,可以使用以下这段代码,非常好用。

     <?

china1store

header("Content-type:application/vnd.ms-excel");  
header("Content-Disposition:filename=test.xls");  
/*
$ip ="localhost";
$db = "uc";
$user = "root";
$pwd = "root";
*/
$ip ="localhost";
$db = "shopuc";
$user = "shopuc";
$pwd = "##RFV##uc";
$con = mysql_connect($ip,$user,$pwd);
mysql_query("set names 'GBK'");
mysql_select_db($db);
$re = mysql_query("select * from uc_members order by uid desc");
$str = '';

powered by china1store.com X[;N6[A*zYm)[.d0

while ($r = mysql_fetch_array($re)) {
 echo iconv("UTF-8","GBK",$r['username'])."\t";
 echo iconv("UTF-8","GBK",$r['email'])."\t\n";
 
}

内容来自china1store.cn &NN%d q Dcy:Ln0


?>

 

www.china1store.com H4h.M)[ F0c1]*k0

 

china1store.cn

<?php

www.china1store.cn ;SZ:JO.LHU]\

$ip ="localhost";
$db = "shopuc";
$user = "shopuc";
$pwd = "##RFV##uc";
$con = mysql_connect($ip,$user,$pwd);
mysql_query('set names "utf8"');
mysql_select_db($db);
$re = mysql_query("select * from uc_members order by uid desc");

www.china1store.com H4h.M)[ F0c1]*k0

mysql_query("set names 'UTF8'");
$fp = fopen('file.csv', 'w');
while ($v = mysql_fetch_array($re)) {
   fputcsv($fp, array(iconv("UTF-8","GBK",$v['username']),$v['email']));
 
} 独立网店制作

fclose($fp);

www.china1store.cn ;SZ:JO.LHU]\

?>
<A href="/file.csv">x</a> www.china1store.net N9nx0k M RG]+iR0

有帮助
(0)
0%
没帮助
(0)
0%
  • 上一篇:如何使用ecshop中ajax功能
  • 下一篇:没有了