Skip to content

Instantly share code, notes, and snippets.

@lgh06
Created June 1, 2017 07:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lgh06/90b3c2c061b5b40fcdbc1912d37f36c5 to your computer and use it in GitHub Desktop.
Save lgh06/90b3c2c061b5b40fcdbc1912d37f36c5 to your computer and use it in GitHub Desktop.
<?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