当前位置:网站首页>How to export Excel files with php+mysql
How to export Excel files with php+mysql
2022-07-24 05:38:00 【amogogo12】
How to use it? php+mysql I won't say much about printing data . Just say how to export data to excel
ob_end_clean();//
$file_name=' data .xls';
$userBrowser = $_SERVER['HTTP_USER_AGENT'];
if ( preg_match( '/MSIE/i', $userBrowser ) ) {
$filename = urlencode($filename);
}
$filename = iconv('UTF-8', 'gb2312', $filename);
header("<meta http-equiv='X-UA-Compatible' content='IE=Edge'>");
header("<meta http-equiv='content-type' content='text/html;charset=uft-8'>");
header("Content-Type: application/vnd.ms-excel");
header("Expires:0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("content-disposition: attachment;filename={
$file_name}");
header( "Cache-Control: public" );
header( "Pragma: public" );
header( "Content-type: text/csv" ) ;
header( "Content-Dis; filename={
$file_name}" ) ;
echo " full name "."\t";
echo " Telephone "."\t";
echo "\t\n";
$dsql->SetQuery($sql);// take SQL Query statement formatting
$dsql->Execute();// perform SQL operation
// Here, the results in the execution query are output circularly . You can cycle out data according to your program
while($row = $dsql->GetArray()){
echo $row['title']."\t";
echo $row['tel']."\t";
echo "\t\n";
}
This exported data , similar csv Format , use wps Open it, no problem .
For reference only
边栏推荐
- 盘点波卡生态潜力项目 | 跨链特性促进多赛道繁荣
- Draw a square on the screen and use ice BMP texture maps the square; Draw a yellow teapot after the square. Assuming that the square is transparent, draw the mixed effect of teapot and square; Adjust
- 3. Draw a five sided cone with a square bottom on the screen. The bottom of the cone is on the xoz plane and the top of the cone is on the Y axis. Use the following figure to map the texture of the fo
- Promise续(尝试自己实现一个promise)更详细的注释和其它接口暂未完成,下次咱们继续。
- pycharm 配置局域网访问,局域网无法访问解决办法
- 收藏==学废
- Substrate 技术及生态5月大事记 | Square One 计划启动,波卡上线 XCM!
- PoS机制随机性解读,波卡的随机性原理如何运作?
- mapboxgl + geoserver 配置本地地图教程
- 自定义MVC 2.0
猜你喜欢
随机推荐
Hurry in!! Easily master the three structures of "sequence", "branch" and "cycle" of C language
mysql查询手机号码后四位,前几位怎么写?
根据数组中对象的某个属性值进行排序
Useref create dynamic reference
Station B video comment crawling - take the blade of ghost destruction as an example (and store it in CSV)
String_ Method_ 01match method
如何强制卸载Google浏览器,不用担心Google打开为白板,亲测有效。
利用流媒体将RSTP流转成WEB端播放(二)[可回看]
函数闭包
B站视频评论爬取——以鬼灭之刃为例(并将其存储到csv中)
php的多选、单选结果怎么在前台显示?
Scarcity in Web3: how to become a winner in a decentralized world
波卡生态发展不设限的奥义——多维解读平行链
在本地怎么使用phpstudy搭建WordPress网站
Latex learning notes (I) - installation configuration
flex布局
Constructor_ Date constructor
mapboxgl + geoserver 配置本地地图教程
useRef 创建动态引用
【奖励发放】OneOS专区首届征文活动评奖结果公布









