Cml\View\Excel::display PHP Method

display() public method

生成Excel文件
public display ( string $filename = '' ) : void
$filename string
return void
    public function display($filename = '')
    {
        $filename == '' && ($filename = 'excel');
        $this->config('utf-8', false, 'default', $filename);
        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";
        foreach ($this->args as $val) {
            $rows = $this->addRow($val);
            echo "<Row>\n" . $rows . "</Row>\n";
        }
        echo "</Table>\n</Worksheet>\n";
        echo "</Workbook>";
        exit;
    }