gover / tp5-ding-exception
dingding exception
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:Smarty
Requires
- guzzlehttp/guzzle: ^6.3
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获取链接