<?php //1、將timestamp, nonce, token 按字典序排序 $timestamp = $_GET['timestamp']; $nonce = $_GET['nonce']; $token = 'weixin'; //你在公眾平臺上填寫的token $signature = $_GET['signature']; $arr = array( $timestamp, $nonce, $token ); sort($arr); //2、將排序后的3個引數拼接后用sha1加密 $tmpstr = implode('', $arr); $tmpstr = sha1($tmpstr); //3、將加密后的字串與signature進行對比,判斷該請求是否來自微信 if($tmpstr == $signature){ echo $_GET['echostr']; exit; }
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/51269.html
標籤:PHP
