Please tell me about phpexecl! !
奥立奥
奥立奥 2018-07-09 20:52:48
0
3
1161

I want to export a column array to execl and then download it in the browser. I have found many examples but it doesn't work. The array cannot be passed. Posting examples doesn't work either.


<?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; ?> - Member Center - My flow</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">Bafang Flow query system</h1><br>

<h5 style="text-align: center"> (The system has listed data according to your permissions)</h5>< br>

<?php

error_reporting( E_ALL&~E_NOTICE );

$dosql->Query("SELECT ypname FROM `#@__unanameym` WHERE uname= '$c_uname' ORDER BY id DESC");

if($dosql->GetTotalRow() > 0)

?>

<?php

while($row2 = $dosql->GetArray())

{

?>

<?php

$row3 = $row2['ypname'];

$row5[]= $row3;

}

?> bgcolor=#DCDCDC>

                                                  "7%">Specifications</th>

                                                                                                                                                                                                                                                               > Unit ;/th>

                                                                                                                                                                                                                                               

                                                                                                          

$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;


$r2 = $row7['guige'] ;

$r22[]= $r2;


$r3 = $row7['shengcan'] ;

$r33[]= $r3;


$r4 = $row7['danwei'] ;

$r44[]= $r4;


$r5 = $row7['pihao'] ;

$r55[]= $r5;


$r6 = $row7['bz'] ;

$r66[]= $r6;


$r7 = $row7['rq'] ;

$r77[]= $r7;


$r8 = $row7['djlx'] ;

$r88[]= $r8;


$r9 = $row7['rk'] ;

$r99[]= $r9;


$rw = $row7['ch'] ;

$rww[]= $rw;



}


    }

 $_SESSION["temp"]=array('$r11');


?>



<?php

$l = count($r11);

for($i = 0 ; $i <= $l ; $i ){

?>

     <table width="880" border="1">

 

 

        <tr>

             <td width="12%"><?php echo $r11[$i]?></td>

             <td width="7%"><?php echo $r22[$i]?></td>

             <td width="13%"><?php echo $r33[$i]?></td>

             <td width="6%"><?php echo $r44[$i]?></td>

              <td width="6%"><?php echo $r55[$i]?></td>

              <td width="24%"><?php echo $r66[$i]?></td>

              <td width="8%"><?php echo $r77[$i]?></td>

              <td width="6%"><?php echo $r88[$i]?></td>

              <td width="9%"><?php echo $r99[$i]?></td>

              <td width="9%"><?php echo $rww[$i]?></td>

       </tr>

              </table>


<?php

}


?>

<div><a href="./Process1.php" rel="external nofollow" >导出excel表格</a></div>


<?php

session_start();

$arr = array(1,2,3,4,5 ,6);

        $arrse = serialize($arr);

        $_SESSION['sessarr'] = $arrse;//Serialization, objects or arrays can be stored in the session中

?>









# <?php


## ?>

<?php

                 

?>

<?php

             

?>

<?php

?>

<?php

?>

<?php

?>

           






## <?php

?>


<li id="act-pnt" align="right" ><h2><a href="javascript:;" onclick="window. print();">Print this page</a></h2></li>

</ul>


##</script>




# #<div class="cl"></div>

<div class="footer"><?php echo $cfg_copyright; ?></div>

</body>

</html>

Second php



<?

$arr = unserialize($_SESSION['sessarr']);//Deserialization

echo $_SESSION['sessarr'];

echo "<br>";

print_r($arr);

?>

Please write down the code in detail. .

奥立奥
奥立奥

reply all(2)
无忌哥哥

What is your error report? See the error report to solve the problem.

  • reply This problem was solved with a post~ But there is a new problem~ When I click to open the processing page, there is no error or download prompt~ It is blank.
    奥立奥 author 2018-07-10 16:59:52
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!