微信開發接入
============
[官方接入文檔](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421135319&token=&lang=zh_CN)
核心步驟
--
1. 在公眾號后臺設置好URL、token 等參數
2. 相關名詞解釋

3. 接入步驟
~~~
加密/校驗流程如下:
1. 將token、timestamp、nonce三個參數進行字典序排序
2. 將三個參數字符串拼接成一個字符串進行sha1加密
3. 開發者獲得加密后的字符串可與signature對比,標識該請求來源于微信
~~~
核心代碼
--
~~~
<?php
//微信公眾平臺開發接入實例代碼
define(TOKEN,'weixin1234');
$timestamp = $_GET['timestamp'];
$nonce = $_GET['nonce'];
$token = TOKEN;
$signature = $_GET['signature'];
$tmpArr = array($timestamp,$nonce,$token);
sort($tmpArr,SORT_STRING);
$tmpStr = sha1(implode($tmpArr));
if ($tmpStr == $signature){
echo $_GET['echostr'];
}else{
echo 'FALSE';
}
~~~