头像

PHPexcel之excel导出和导入

2017-07-18 17:03:18 收藏    来源:PHP代码   浏览()   评论 ( 0 )   

PHPexcel之excel导出和导入
本文用原生PHP来演示导出和导入,包括上传也是用的原生。
查看演示 下载资源:1

手机扫码访问:

下载资源 下载积分:150

  表单HTML代码:

    <p style="margin:10px 0"><a href="export.php" class="btn">导出</a></p> 
    <form action="import.php" method="post" enctype="multipart/form-data"> 
        <div class="control-group"> 
            <label>Excel表格:</label> 
            <input type="file"  name="file"/> 
        </div> 
        <div class="control-group"> 
            <input type="submit"  value="导入" /> 
        </div> 
    </form>

  PHP之excel导出

    $query = mysql_query("select * from user limit 50");  
    $i =0; 
    $list = array(); 
    while($row=mysql_fetch_array($query)){  
        $list[$i]['id'] = $row['id'];  
        $list[$i]['username'] = $row['username'];  
        $list[$i]['password'] = $row['password'];  
        $i++; 
    }  
     
    $title = array('ID', '邮箱', '密码'); //设置要导出excel的表头


标签: 导出导入
声明:转载请注明来源(PHP代码)并保留原文链接:http://www.phpdaima.com/plug-47.html
广告不存在
评论0

后面还有条评论,点击查看>>

温馨提示:为规范评论内容,垃圾评论一律封号...

PHPexcel之excel导出和导入
我的积分余额: 0.0 已下载次数: 1
所需积分:150150 开始下载
×