server酱需要去sc.ftqq.com申请 并且绑定你的微信 ,然后别人可以直接从网页发消息给你的微信
typecho回复提示推送
/**
* 回复触发Server酱
*/
Typecho_Plugin::factory('Widget_Feedback')->comment = array('ComWechat', 'sc_send');
class ComWechat {
public static function sc_send($comment, $post)
{
$sckey = Helper::options()->Serkey; //获取Server酱SCKEY
$text = "有人在您的博客发表了评论";
$desp = "**".$comment['author']."** 在 [「".$post->title."」](".$post->permalink." \"".$post->title."\") 中说到: \n\n > ".$comment['text'];
$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);
$result = file_get_contents('http://sc.ftqq.com/'.$sckey.'.send', false, $context);
return $comment;
}
}
这里
$sckey = Helper::options()->Serkey; //获取Server酱SCKEY
当然,如果没有做有这方面的配置可以直接这样写
$sckey = 'abcdfazktpquaqtqrragz100'; //自己Server酱SCKEY
这样就可以有人回复评论的时候,自动推送到自己的微信了
这里是回复评论的,如果是其他地方自定义的页面,比如表单之类的,可以这样
吹牛逼 提交系统
Title
这里是参考https://ycb.hk/archives/99.html
回头再想想,还有什么可以搭配使用的…… 然后再继续更新……
!
发表评论