1、企业微信设置参考我这篇博客
https://blog.csdn.net/weixin_44880442/article/details/121774231?spm=1001.2014.3001.5501
2、PHP代码
#key=企业微信机器人中的值
$webhook = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key="; #这里需要修改
# curl初始化
$curl = curl_init();
#需要推送的url
curl_setopt($curl, CURLOPT_URL, $webhook);
curl_setopt($curl, CURLOPT_POST, 1);
#content必须是utf8编码
curl_setopt($curl, CURLOPT_HTTPHEADER,array('Content-Type: application/json;charset=utf-8'));
#content 为需要推送的内容
$post_data = '
{
"msgtype": "text",
"text": {
"content": "hello world"
}
}';
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
$data = curl_exec($curl);
curl_close($curl);
?>
3、效果
4、官方参数详解
https://work.weixin.qq.com/api/doc/90000/90136/91770