亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Home PHP Libraries Other libraries PHP class to export excel table
PHP class to export excel table
<?php
  public function setEncode($incode,$outcode){
    $this->inEncode=$incode;
    $this->outEncode=$outcode;
  }
  public function setTitle($titlearr){
    $title="";
    foreach($titlearr as $v){
      if($this->inEncode!=$this->outEncode){
        $title.=iconv($this->inEncode,$this->outEncode,$v)."\t";
      }
      else{
        $title.=$v."\t";
      }
    }
    $title.="\n";
    return $title;
  }

Usage method

$excel=new Excel();

Set encoding:

$excel->setEncode("utf-8" ,"gb2312"); //If you don't want to transcode, just write the same parameters, for example $excel->setEncode("utf-8","utf-8");

settings Title bar

$titlearr=array("a","b","c","d");

Set content bar

$contentarr=array(

1=>array("ab","ac","ad","ae"),

2=>array( "abc","acc","adc","aec"),

3=>array("abd","acd","add","aed"),

4=>array("abe","ace","ade","aee"),

);

$excel->getExcel($titlearr,$ contentarr,"abc");


Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

How to export table data to Excel using Navicat? How to export table data to Excel using Navicat?

19 Jul 2025

Navicat supports exporting database table data to Excel. The steps are as follows: 1. Right-click on the target table and select "Export Wizard"; 2. Select Excel (.xlsx or .xls) in the export format and specify the save path; 3. Select the export content (structure, data or both); 4. Set mapping rules on the field page, such as format conversion, field renaming, filtering columns, etc.; 5. Execute the export after confirming that it is correct. In addition, you can also export the results by querying the results. After running the SQL statement, click the "Export" button in the result area. Only the current results are exported and displayed to Excel, which is suitable for exporting some data scenarios. Pay attention to handling field formats to avoid garbled codes, and consider paging or limiting row counts when large data volumes to improve performance.

How to export database table data to Excel file using PHPMyAdmin How to export database table data to Excel file using PHPMyAdmin

19 May 2025

Use PHPMyAdmin to easily export database table data to Excel files. The specific steps are as follows: 1. Open PHPMyAdmin and select database and tables. 2. Click the "Export" option, select Excel format and click "Execute" to download the file. Note that during the export process, challenges such as large data volume, data format adjustment, encoding problems and data type conversion may be required. The export process can be optimized by batch export, customizing the format, ensuring consistent encoding and preprocessing data.

How to Export MySQL Data to Separate Excel Cells using PHP? How to Export MySQL Data to Separate Excel Cells using PHP?

25 Nov 2024

Retrieving MySQL Data in Separate Excel Cells using PHPYour original PHP script combines all text values into a single Excel cell, conflicting...

How Do I Link Static Libraries That Depend on Other Static Libraries? How Do I Link Static Libraries That Depend on Other Static Libraries?

13 Dec 2024

Linking Static Libraries to Other Static Libraries: A Comprehensive ApproachStatic libraries provide a convenient mechanism to package reusable...

How to export Excel file and set column width in native PHP? How to export Excel file and set column width in native PHP?

31 Mar 2025

When exporting Excel files using native PHP, you often encounter the problem of how to set the column width. This article will focus on "How to export Excel files in native PHP and...

How can I export MySQL data to Excel using PHP and ensure proper cell distribution? How can I export MySQL data to Excel using PHP and ensure proper cell distribution?

25 Nov 2024

Exporting MySQL Data to Excel in PHPWhen exporting MySQL data to Excel, it's crucial to ensure that the data is properly distributed across...

See all articles