想将一个列数组导出到execl然后浏览器下载,找了很多例子跟着做也不行,数组跟本就传递不过去。用例子照贴也不行。
<?php if(!defined('IN_MEMBER')) exit('Request Error!'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $cfg_webname; ?> - 会员中心 - 我的流向</title>
<link href="<?php echo $cfg_webpath; ?>/templates/default/style/member.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="<?php echo $cfg_webpath; ?>/templates/default/js/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo $cfg_webpath; ?>/templates/default/js/member.js"></script>
</head>
<body>
<div class="header">
<?php require_once(dirname(__FILE__).'/header.php'); ?>
</div>
<div class="mainbody">
<h1 style="text-align: center">八方流向查询系统</h1><br>
<h5 style="text-align: center">(系统已根据您的权限列出数据)</h5><br>
<?php
error_reporting( E_ALL&~E_NOTICE );
$dosql->Query("SELECT ypname FROM `#@__unameym` WHERE uname='$c_uname' ORDER BY id DESC");
if($dosql->GetTotalRow() > 0)
?>
<?php
while($row2 = $dosql->GetArray())
{
?>
<?php
$row3 = $row2['ypname'];
$row5[]= $row3;
}
?>
<ul class="list">
<table width="880" border="1" bgcolor=#DCDCDC>
<tr>
<th width="12%">商品名称</th>
<th width="7%">规格</th>
<th width="13%">厂商</th>
<th width="6%">单位</th>
<th width="6%">批号</th>
<th width="24%">备注</th>
<th width="8%">日期</th>
<th width="6%">单据</th>
<th width="9%">入库数量</th>
<th width="9%">出货数量</th>
</tr>
</table>
<?php
$p = count($row5);
for($j = 0 ; $j <= $p ; $j++){
$dosql->Execute("select * from `#@__liuxiang`WHERE ypname = '$row5[$j]'ORDER BY id DESC");
if($dosql->GetTotalRow() > 0)
while($row7 = $dosql->GetArray()){
$r1 = $row7['ypname'];
##$r11[]= $r1;
##$r3 = $row7['盛灿'] ;
$r33[]= $r3;
$r4 = $row7['danwei'] ;
$r44[]= $r4;
#$r5 = $ row7['pihao'] ;
$r55[]= $r5;
#$r6 = $row7['bz'] ;
#$r7 = $row7['rq'] ;
#$r8 = $row7['djlx'] ;
$r9 = $row7['rk'] ;
#$ rw = $ row7['ch'] ;
# }
## }
? >
< ?php
<?php
session_start();
$arr = array(1,2,3,4,5,6);
$arrse = serialize($arr);
$_SESSION['sessarr'] = $arrse;//序列化,对象或者数组都可以这样存放到session中
?>
<?php
?>
<?php
?>
<?php
?>
<?php
?>
<?php
?>
<?php
?>
<?php
?>
<li id="act-pnt" align="right" ><h2><a href="javascript:;" onclick="window.print();">打印本页</a></h2></li>
</ul>
</script>
<div class="cl"></div>
<div class="footer"><?php echo $cfg_copyright; ?></div>
</body>
</html>
第二个php
<?
$arr = unserialize($_SESSION['sessarr']);//反序列化
echo $_SESSION['sessarr'];
echo "<br>";
print_r($arr);
?>
求大大具体写下代码。。
可以看下这个导Excel的 https://blog.csdn.net/toume/article/details/80937438
你的报错是什么,看报错来解决问题。