Mini program message push configuration case

angryTom
Release: 2020-03-07 10:27:29
forward
3912 people have browsed it

This article introduces the configuration method of the message push capability of the WeChat mini program. I hope it will be helpful to friends who are learning mini program development!

Mini program message push configuration case

Mini program message push configuration case

In order to enrich the service capabilities of the mini program and improve service quality, WeChat is The Mini Program provides customer service messaging capabilities so that Mini Program users can communicate with the Mini Program service provider conveniently and quickly. After enabling and setting the message push configuration, messages sent by users to the mini program and event push required by developers will be forwarded to the server address by WeChat. Let's take a look at how to configure this. This is a case rendering of my own configuration.

Recommended learning:Small program development

Mini program message push configuration case

I define the api.php file in the root directory of my server, and fill in the address of the URL For http://www.100txy.com/api.php, the specific code of the file api.php is as follows

isValid(); class wechatAPI { public function isValid()//验证微信接口,如果确认是微信就返回它传来的echostr参数 { $echoStr = $_GET["echostr"]; if ($this->checkSignature()) { echo $echoStr; exit; } } private function checkSignature(){ //官方的验证函数 $signature = $_GET["signature"]; $timestamp = $_GET["timestamp"]; $nonce = $_GET["nonce"]; $token = TOKEN; $tmpArr = array($token, $timestamp, $nonce); sort($tmpArr, SORT_STRING); $tmpStr = implode( $tmpArr ); $tmpStr = sha1( $tmpStr ); if( $tmpStr == $signature ){ return true; }else{ return false; } } };
Copy after login

After configuration and submission, it can be enabled successfully!

For more related tutorials, please pay attention toPHP Chinese website!

The above is the detailed content of Mini program message push configuration case. For more information, please follow other related articles on the PHP Chinese website!

source:www.100txy.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!