代码中的appSecret为机器的人密钥
密钥

                    $timestamp=time()*1000;
                    $appSecret="SEC9d9ea51fc26cdc1fe2eeb4c8b781c39558a472ae2a18670990af46707de6a7c1";
                    $sign = hash_hmac('sha256',  $timestamp . "\n" . $appSecret, $appSecret, true);
                    $signature = base64_encode($sign);
                    $s = urlencode($signature);
                    $token = "95ececd18f4526ea4d7640f245179616ee3663cba0a2790d87fe595322c7681d";
                    $url = "https://oapi.dingtalk.com/robot/send?access_token=" . $token."&timestamp=".$timestamp."&sign=".$s;
                    $header = ["Content-Type: application/json;charset=utf-8;"];
                    $json = [
                        "msgtype"=>"markdown",
                        "markdown"=>[
                            "title"=>"课程分享链接",
                            "text"=>"{$data['s_title2']}@这套课程链接失效",
                        ],
                        "at"=>[
                            "atMobiles"=>[
                                "18614031233",
                            ],
                            "isAtAll"=>false,
                        ]
                    ];
                    $res=cUrl($url, $header, json_encode($json));
Last modification:December 29, 2021
如果觉得我的文章对你有用,请随意赞赏