获取 Server酱SendKey
微信扫码登录获取 Server酱
Turbo 版官网
微复制以下 SendKey
备用
在wordpress主题 function.php
或 functions.php
文件尾部添加以下代码
//评论微信推送function sc_send($comment_id){$text = '自定义标题文字';$comment = get_comment($comment_id);$desp = $comment->comment_content;$key = '你的Server酱SendKey';$postdata = http_build_query(array('text' => $text,'desp' => $desp));$opts = array('http' =>array('method' => 'POST','header' => 'Content-type: application/x-www-form-urlencoded','content' => $postdata));$context = stream_context_create($opts);return $result = file_get_contents('https://sctapi.ftqq.com/'.$key.'.send', false, $context);}add_action('comment_post', 'sc_send', 19, 2);//评论微信推送 function sc_send($comment_id){ $text = '自定义标题文字'; $comment = get_comment($comment_id); $desp = $comment->comment_content; $key = '你的Server酱SendKey'; $postdata = http_build_query( array( 'text' => $text, 'desp' => $desp ) ); $opts = array('http' =>array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata )); $context = stream_context_create($opts); return $result = file_get_contents('https://sctapi.ftqq.com/'.$key.'.send', false, $context); } add_action('comment_post', 'sc_send', 19, 2);//评论微信推送 function sc_send($comment_id){ $text = '自定义标题文字'; $comment = get_comment($comment_id); $desp = $comment->comment_content; $key = '你的Server酱SendKey'; $postdata = http_build_query( array( 'text' => $text, 'desp' => $desp ) ); $opts = array('http' =>array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata )); $context = stream_context_create($opts); return $result = file_get_contents('https://sctapi.ftqq.com/'.$key.'.send', false, $context); } add_action('comment_post', 'sc_send', 19, 2);
选择推送通道
点击https://sct.ftqq.com/forward
查看可选通道,博主用的是 iOS Bark
版通道
推送事例
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END