Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 数组到函数中(导出xls文件)_Php_Html - Fatal编程技术网

Php 数组到函数中(导出xls文件)

Php 数组到函数中(导出xls文件),php,html,Php,Html,我不知道如何传递所有列中的所有数组,以便将它们导出为xls文件 我在想这样的事情: <a href='".site_url('main_page/EXPORT') 你能帮我吗?再创建一个td,并在其中添加导出链接。在导出页面上检查id并从数据库获取数据。然后将这些数据放入xls文件。感谢您回复@u_mulder。我想的是这样的:header('Content-Type:application/xls');标题('Content-Disposition:attachment;filenam

我不知道如何传递所有列中的所有数组,以便将它们导出为xls文件

我在想这样的事情:

<a href='".site_url('main_page/EXPORT')

你能帮我吗?

再创建一个
td
,并在其中添加导出链接。在导出页面上检查id并从数据库获取数据。然后将这些数据放入xls文件。感谢您回复@u_mulder。我想的是这样的:header('Content-Type:application/xls');标题('Content-Disposition:attachment;filename=download.xls');您将如何操作?生成Excel文件的代码在哪里?您需要指定您正在使用的框架或cms,因为您尝试执行的操作特定于您正在使用的工具
<div class="container"> 
<div class="row">
<div class="col-md-12">

    <h2 align="center">TABLE: USERS</h2>

        <table class="table table-hover" align="center" border="1" cellspacing="0" cellpadding="0" width="700" id="table">
            <thead>
                <th>id</th>
                <th>user</th>
                <th>name</th>
                <th>lastname</th>
                <th>type</th>
                <th>status</th>
                <th>date</th>
            </thead>
<?php

    if (count($records) > 0 && $records != false)
     { 

        foreach($records as $record) {
        echo "<tr> 
    <td>".$record['id']."</td> 
    <td>".$record['username']."</td> 
    <td>".$record['name']."</td> 
    <td>".$record['lastname']."</td> 
    <td>".$record['type']."</td> 
    <td>".$record['status']."</td> 
    <td>".$record['date']."</td> 

    </tr>"; 
    }
    }

?>
echo "<tr> 
<td>".$record['id']."</td> 
<td>".$record['username']."</td> 
<td>".$record['name']."</td> 
<td>".$record['lastname']."</td> 
<td>".$record['type']."</td> 
<td>".$record['status']."</td> 
<td>".$record['date']."</td> 
<a href='".site_url('main_page/EXPORT')."/$record->id'> //THIS IS POBABLY WRONG
<button type='button' class='btn btn-primary'>EXPORT</button></a>
</tr>"; 

    </tbody>
public function EXPORT(){

        $data['records']=$this->MODEL->EXPORT_XLS();
        $this->load->view('page_view',$data);