PHP code example of yuxiaobo / workwechat-bot-notify

1. Go to this page and download the library: Download yuxiaobo/workwechat-bot-notify library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

yuxiaobo / workwechat-bot-notify example snippets


$notify = new WorkWechatBotNotify($_ENV['key']);
$notify->sendText('这是一个测试', [], ['18311548014']);

$notify = new WorkWechatBotNotify($_ENV['key']);
$notify->sendMarkdown("# 这是一个`Markdown`测试\n> 111");

$notify = new WorkWechatBotNotify($_ENV['key']);

// 文件资源
$notify->sendImage(fopen(ROOT_PATH . '/tests/test.jpeg', 'r'));
// 或文件路径
// $notify->sendImage(ROOT_PATH . '/tests/test.jpeg');

$notify = new WorkWechatBotNotify($_ENV['key']);
$notify->sendNews('中秋节礼品领取', '欢度中秋佳节', 'doc.edk24.com', 'http://res.mail.qq.com/node/ww/wwopenmng/images/independent/doc/test_pic_msg1.png');

$notify = new WorkWechatBotNotify($_ENV['key']);
$mediaId = $notify->uploadFile(fopen(ROOT_PATH . '/tests/test.jpeg', 'r'));
$notify->sendFile($mediaId);