課程
/后端開發
/PHP
/PHP實現微信公眾平臺開發—基礎篇
還是沒講述明白我們如何判斷是否是微信服務器向我們發送的Get請求
2016-05-22
源自:PHP實現微信公眾平臺開發—基礎篇 4-6
正在回答
<?php
//獲得參數 signature nonce token timestamp echostr
$nonce ? ? = $_GET['nonce'];
$token ? ? = 'imooc';
$timestamp = $_GET['timestamp'];
$echostr ? = $_GET['echostr'];
$signature = $_GET['signature'];
//形成數組,然后按字典序排序
$array = array();
$array = array($nonce, $timestamp, $token);
sort($array);
//拼接成字符串,sha1加密 ,然后與signature進行校驗
$str = sha1( implode( $array ) );
if( $str ?== $signature && $echostr ){
//第一次接入weixin api接口的時候
echo ?$echostr;
exit;
}
舉報
由淺入深一起玩轉微信公眾平臺開發,課程由淺入深,內容詳實
2 回答微信開發服務器
1 回答老師,我想請問你,微信公眾平臺如何與學校圖書館的服務器對接???mysql又如何與學校金盤圖書館系統的oracle對接?
2 回答服務器配置無法啟用(微信開發)
1 回答如何將代碼放在阿里云服務器上?
1 回答注冊的時候,我選擇的是服務號,登錄進去是微信開發平臺。
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2016-05-22
<?php
//獲得參數 signature nonce token timestamp echostr
$nonce ? ? = $_GET['nonce'];
$token ? ? = 'imooc';
$timestamp = $_GET['timestamp'];
$echostr ? = $_GET['echostr'];
$signature = $_GET['signature'];
//形成數組,然后按字典序排序
$array = array();
$array = array($nonce, $timestamp, $token);
sort($array);
//拼接成字符串,sha1加密 ,然后與signature進行校驗
$str = sha1( implode( $array ) );
if( $str ?== $signature && $echostr ){
//第一次接入weixin api接口的時候
echo ?$echostr;
exit;
}