Skip to content

自定义上报器

必须要继承 think\health\Contract\ReportAbstracte

php
<?php
declare(strict_types=1);

namespace app\report;

use think\health\CheckResult;
use think\health\Contract\ReportAbstracte;

class ReportApp extends ReportAbstracte
{
    public function handle(CheckResult $result): void {
        // report logic
    }
}

编写好自定义的上报器后,需要在配置文件中的 reportHandles 添加您的上报器

php
[
    'reportHandles' => [
        // ... 其他上报
        new \app\report\ReportApp()
    ],
]