gover/tp5-ding-exception

There is no license information available for the latest version (v3.0.0) of this package.

dingding exception

v3.0.0 2019-03-29 09:30 UTC

This package is auto-updated.

Last update: 2025-06-29 01:41:06 UTC


README

composer 安装命令

composer require gover/tp5-ding-exception

部署流程

第一步:引入DingTalk.php和ExceptionFormat.php两个文件

第二步:放置好think_exception.tpl

第三步:参考demo代码,发送钉钉异常警报(tpl路径可以在ExceptionFormat里showTpl方法中修改)

配置 .env

[dingtalk] access_token = xxxxxxx

demo代码

      //发送钉钉报警,$e是Exception异常对象
      $e_info = ExceptionFormat::getDingActionCard($e);
      $btn = [['title' => '详情', 'actionURL' => $e_info['url']],];
      DingTalk::getInstance()->sendActionCard('异常消息' . date('H:i:s'), $e_info['text'], $btn, 1, 1);

备注: 钉钉token获取链接