Created
June 1, 2017 07:07
-
-
Save lgh06/90b3c2c061b5b40fcdbc1912d37f36c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$signature = $_GET['signature']; | |
$timestamp = $_GET['timestamp']; | |
$nonce = $_GET['nonce']; | |
$echostr = $_GET['echostr']; | |
$selfToken = 'If985hike'; | |
// 自行计算的signature | |
$enc = k_verify($selfToken, $timestamp, $nonce); | |
function k_verify($selfToken, $timestamp, $nonce) { | |
$array = array($selfToken, $timestamp, $nonce); | |
sort($array, SORT_STRING); | |
$str = implode($array); | |
return sha1($str); | |
} | |
if($enc == $signature){ | |
echo $echostr; | |
}else{ | |
echo ''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment