当前位置:网站首页>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
边栏推荐
- select_ Render small phenomena
- 通用分页2.0
- Open Web3, once unpopular decentralized identity (did)
- grid布局
- What is the function of key
- 面向 对象
- Variables and constants in C language
- JS输出字符串中出现最多次数的字符
- Unknown collation: ‘utf8mb4_0900_ai_ci‘的解决方法
- The profound meaning of unlimited ecological development in Poka -- Multidimensional Interpretation of parallel chain
猜你喜欢

Node connects to MySQL and uses Navicat for visualization

vulnhub-SolidState: 1靶机渗透测试

special effects - 鼠标移动,出现星星拖尾

Function analysis of GeoServer rest API

Restore UI design draft

Tree structure + node

关于DAO流动性双币质押挖矿开发原理分析

Pycharm configures LAN access, and the LAN cannot access the solution

The profound meaning of unlimited ecological development in Poka -- Multidimensional Interpretation of parallel chain

Hurry in!! Take you to understand what is multi file, and easily master the usage of extern and static C language keywords!!!
随机推荐
useRef 创建动态引用
自定义MVC 1.0
Moonbeam orbiters program: provides a new way for collectors to participate in moonbeam and Moonriver
Canvas Bezier Bezier curve
树状结构+节点
visibility:hidden 和 display:none
special effects - 鼠标点击,出现随机颜色的爱心
Hex to RGB
稀缺性之于Web3:如何成为去中心化世界的胜利者
Inventory Poka ecological potential project | cross chain characteristics to promote the prosperity of multi track
微信小程序返回携带参数或触发事件
php+mysql导出excel文件方法
7. Draw a Bezier curve on the screen and smooth the curve with anti aliasing technology.
6. Draw a Bezier curve and a Bezier surface on the screen
Web3 Foundation grant program empowers developers to review four successful projects
关于DAO流动性双币质押挖矿开发原理分析
公司女同事深夜11点让我去她住处修电脑,原来是C盘爆红,看我一招搞定女同事....的电脑
Pycharm configures LAN access, and the LAN cannot access the solution
渗透测试知识---行业术语
通用分页2.0