MyReport1.view.php
<?php
use \koolreport\widgets\koolphp\Table;
?>
<html>
<body style="margin:0.5in 1in 0.5in 1in">
<head>
<link rel="stylesheet" href="/packages/koolReport/assets/bootstrap/css/bootstrap.min.css"/>
<link rel="stylesheet" href="/packages/koolReport/assets/bootstrap/css/bootstrap-theme.min.css"/>
</head>
<hr/>
<div class="text-center">
    <h2>消防设备巡检结果</h2>
    <h5>任务名称:<?php echo "test1"; ?></h5>
</div>
<hr/>
<?php
Table::create(array(
    //datastore与MyReport.php中同参数
    "dataStore" => $this->dataStore('respect_report'),
    "columns" => array(
        "device_name" => array(
            "type" => "string",
            "label" => "设备名称",
        ),
        "address" => array(
            "label" => "地址"
        ),
        "check_items" => array(
            "type" => "string",
            "label" => "检查项"
        ),
        "is_qualified" => array(
            "type" => "string",
            "label" => "状态",
            "formatValue" => function ($value) {
                return $value;
            },
        ),
        "person_in_charge" => array(
            "type" => "string",
            "label" => "责任者"
        ),
        "content" => array(
            "type" => "string",
            "label" => "巡检记录"
        ),
    ),
    "cssClass" => array(
        "table" => "table table-hover table-bordered"
    )
))
 ?>
</body> </html>
function in my controller:
 public function export()
    {
        $report=new MyReport();
        session_start();
        $report->run()->export('MyReport1')->pdf(array(
            "format"=>"A4",
            "orientation"=>"portrait"
        ))->toBrowser("myreport.pdf");
MyReport.php
namespace App\Reports;
use \koolreport\KoolReport;
class MyReport extends KoolReport
{
    use \koolreport\laravel\Friendship;
    use \koolreport\export\Exportable;
    
    function settings()
    {
        return array(
            "assets"=>array("path"=>"../../public/packages/koolReport/assets",
                "url"=>"/packages/koolReport/assets"),
            "dataSources"=>array(
                "report"=>array(
                    'host' => '127.0.0.1',
                    'username' => 'root',
                    'password' => 'root',
                    'dbname' => 'sucg_fp',
                    'charset' => 'utf8',
                    'class' => "\koolreport\datasources\MySQLDataSource"
                ),
            )
        );
    }
    public function setup(){
        $this->src('report')->query("SELECT * FROM tableContents")
            ->pipe($this->dataStore('respect_report'));
        $this->src('report')->query("SELECT * FROM device_classfy_count")
            ->pipe($this->dataStore('pie_report'));
    }
}