WeChat applet URL and TOKEN setup

WeChat applet URL and TOKEN setup

Create a weixin.php file in SAE code, write the following code

  Define ("token", "MyToken"); // Fill in the backstage $ Wechatobj = new wechatapi () in the WeChat public platform, $ wechatobj-> isvalid (); class wechatapi {public function Isvalid () // Verify the WeChat interface, the code other than the verification function and WeChat public account development token settings the same {$ echostr = $ _GET ["echostr"]; if ($ this-> checksignature ()) {header ('Content- TYPE: TEXT '); // Add, be sure to join Header Echo $ Echostr; EXIT;}} private function checksignature () // Official verification function {$ sIGNATURE = $ _Get ["signature"]; $ timestamp = $ _GET ["TimeStamp"]; $ Non = $ _GET ["Non"]; $ TOKEN = Token; $ TMPARR = Array ($ TOKEN, $ TIMESTAMP, $ NONCE); Sort ($ TMPARR, SORT_STRING); $ TMPSTR = Implode $ TMPARR); $ TMPSTR = SHA1 ($ Tmpstr); IF ($ tmpstr == $ sIGNATURE) {Return true;}}}}};  
After saving, access by URL, copy URL in the address bar, write

微信小程序url与token设置详解

In the development settings of the WeChat public platform, fill in the URL and set token, automatically generate encodingaseKey

微信小程序url与token设置详解

Settings

微信小程序url与token设置详解 If you have any questions, please leave a message or to this site community communication, thank you, I hope to help everyone, thank you for your Station support!

© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment