<?php
/** * created by phpstorm.
* user: e450
* date: 2017/12/5
* time: 10:36
*/namespace
usecouchbase\exception;
usethink\facade\log;
useuse
usethink\facade\cookie;
class
wechat
}private
function
getaccesstoken
() else
//儲存token 避免介面上限
cookie::set('accesstoken',$res['access_token'],5000);
return
$res['access_token'];
}}catch (\exception
$e) }
public
function
vaild
()
}public
function
check
() else
}public
function
send
()
echo
$content;
exit;}}
//事件處理函式
public
function
event
()
$tpl = "
%s";
$msg = sprintf($tpl, $fromusername, $tousername, $time, $content);
return
$msg;
}public
function
subscribe
()elseelse
echo
$this->text('功能暫未開放');}}
}/**
* 文字處理函式
*@parm $account_id 賬戶id
*/public
function
text
($account_id)
}/**
* 影象處理
*/public
function
image
()
/*** 【上傳永久】
*@param $file string s檔案路徑
*/public
function
uploadimg
($file)
$media = [ 'media'=> new \curlfile(realpath($file))];
//永久素材上傳
* 獲得素材
* 刪除素材
* 上傳**
*@param $content string **內容
* 關注得到使用者資訊
*@param $openid string 使用者openid
*@param data 選單資料
*獲取關注使用者資訊
***介面
*@param null $data post資料
* 【處理結果】
*@param $url
*@param null $data post資料
*@return mixed*
*/protected
function
dealret
($data)else
}}
php微信簽名 PHP微信介面簽名演算法
一 引數說明 二 安全規範 1 簽名演算法 簽名生成的通用步驟如下 第一步,設所有傳送或者接收到的資料為集合m,將集合m內非空引數值的引數按照引數名ascii碼從小到大排序 字典序 使用url鍵值對的格式 即key1 value1 key2 value2 拼接成字串stringa。特別注意以下重要規...
微信小程式封裝API介面
2.新建資料夾http,api是封裝的介面函式,env是設定公共訪問的url,http是二次封裝wx.request 3.env.js 設定公共訪問的url,即環境變數 module.exports 測試環境 test 線上環境 引入env中的url const require env.js pro...
php寫微信授權介面
class wx param scope 應用授權作用域 snsapi base 不彈出授權頁面,直接跳轉,只能獲取使用者openid snsapi userinfo 彈出授權頁面,可通過openid拿到暱稱 性別 所在地。並且,即使在未關注的情況下,只要使用者授權,也能獲取其資訊 param st...