PHP api导出
/**
* Export data to an Excel file.
*
* @param array $title An array of column titles.
* @param array $data An array of data rows.
* @param string $fileName The name of the file to save.
* @param string $savePath The path where the file should be saved.
* @param bool $isDown Whether the file should be downloaded.
*
* @return string The URL of the saved file.
*/
function exportExcel(array $title, array $data, string $fileName = '', string $savePath = '', bool $isDown = false): string
{
// Create a new PHPExcel object
$objPHPExcel = new PHPExcel();
// Set the sheet title
$objPHPExcel->getActiveSheet()->setTitle('Sheet1');
// Add the title row
$titleCount = count($title);
if ($titleCount > 0) {
$objPHPExcel->getActiveSheet()->fromArray([$