- function sc_send($comment_id)
- {
- $text = '皇上有新的奏章待批阅';
- $comment = get_comment($comment_id);
- $desp = $comment->comment_content;
- $key = 'SCU10446Tehudsfsldfjoods20302d47b1fbdb7597bd07bd61d6';
- $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('http://sc.ftqq.com/'.$key.'.send', false, $context);
- }
- add_action('comment_post', 'sc_send', 19, 2);
复制代码
发送消息的时候,调用$text和$desp,我想在$desp前面再加点东西,怎么加,比方说我要加个文章ID get_the_ID(),求诸位大佬赐教。 |