Cml\Vendor\Excel::excelXls PHP Method

excelXls() public method

生成Excel文件
public excelXls ( array $data ) : void
$data array
return void
    public function excelXls($data)
    {
        header("Content-Type: application/vnd.ms-excel; charset=" . $this->coding);
        header("Content-Disposition: inline; filename=\"" . $this->filename . ".xls\"");
        /*打印*/
        echo stripslashes(sprintf($this->header, $this->coding));
        echo "\n<Worksheet ss:Name=\"" . $this->tWorksheetTitle . "\">\n<Table>\n";
        if (is_array($this->titleRow)) {
            echo "<Row>\n" . $this->addRow($this->titleRow) . "</Row>\n";
        }
        foreach ($data as $val) {
            $rows = $this->addRow($val);
            echo "<Row>\n" . $rows . "</Row>\n";
        }
        echo "</Table>\n</Worksheet>\n";
        echo "</Workbook>";
        exit;
    }