近排在做微信介面開發(fā),所以總結(jié)一下微信授權(quán)登入並取得使用者資訊 這個(gè)介面的開發(fā)流程。
一、首先你的微信公眾號(hào)要取得對(duì)應(yīng)的AppID和AppSecret,申請(qǐng)微信登入且通過審核後,才可開始存取流程。
二、授權(quán)流程
1、流程說明
(1). 第三方發(fā)起微信授權(quán)登入要求,微信使用者允許授權(quán)第三方應(yīng)用後,微信會(huì)拉起應(yīng)用程式或重定向到第三方網(wǎng)站,並且?guī)鲜跈?quán)臨時(shí)票據(jù)code參數(shù);?
(2). 透過code參數(shù)加上AppID和AppSecret等,透過API換取access_token;
(3). 透過access_token進(jìn)行介面調(diào)用,取得使用者基本資料資源或協(xié)助使用者實(shí)現(xiàn)基本操作。
2、取得access_token時(shí)序圖:
#三、開發(fā)(我的用是CI框架,其實(shí)什麼框架都一樣,MVC模式就行了)
1、請(qǐng)求CODE
weixin.php
<?php class weixinController extends CI_Controller { public $userInfo; public $wxId; public function __construct(){ parent::__construct(); //只要用戶一訪問此模塊,就登錄授權(quán),獲取用戶信息 $this->userInfo = $this->getWxUserInfo(); } /** * 確保當(dāng)前用戶是在微信中打開,并且獲取用戶信息 * * @param string $url 獲取到微信授權(quán)臨時(shí)票據(jù)(code)回調(diào)頁面的URL */ private function getWxUserInfo($url = '') { //微信標(biāo)記(自己創(chuàng)建的) $wxSign = $this->input->cookie('wxSign'); //先看看本地cookie里是否存在微信唯一標(biāo)記, //假如存在,可以通過$wxSign到redis里取出微信個(gè)人信息(因?yàn)樵诘谝淮稳〉轿⑿艂€(gè)人信息,我會(huì)將其保存一份到redis服務(wù)器里緩存著) if (!empty($wxSign)) { //如果存在,則從Redis里取出緩存了的數(shù)據(jù) $userInfo = $this->model->redisCache->getData("weixin:sign_{$wxSign}"); if (!empty($userInfo)) { //獲取用戶的openid $this->wxId = $userInfo['openid']; //將其存在cookie里 $this->input->set_cookie('wxId', $this->wxId, 60*60*24*7); return $userInfo; } } //獲取授權(quán)臨時(shí)票據(jù)(code) $code = $_GET['code']; if (empty($code)) { if (empty($url)) { $url = rtirm($_SERVER['QUERY_STRING'], '/'); //到WxModel.php里獲取到微信授權(quán)請(qǐng)求URL,然后redirect請(qǐng)求url redirect($this->model->wx->getOAuthUrl(baseUrl($url))); } } } } ?>
取得code的Controller程式碼
#? Wxmodel.php
<?php class WxModel extends ModelBase{ public $appId; public $appSecret; public $token; public function __construct() { parent::__construct(); //審核通過的移動(dòng)應(yīng)用所給的AppID和AppSecret $this->appId = 'wx0000000000000000'; $this->appSecret = '00000000000000000000000000000'; $this->token = '00000000'; } /** * 獲取微信授權(quán)url * @param string 授權(quán)后跳轉(zhuǎn)的URL * @param bool 是否只獲取openid,true時(shí),不會(huì)彈出授權(quán)頁面,但只能獲取用戶的openid,而false時(shí),彈出授權(quán)頁面,可以通過openid獲取用戶信息 * */ public function getOAuthUrl($redirectUrl, $openIdOnly, $state = '') { $redirectUrl = urlencode($redirectUrl); $scope = $openIdOnly ? 'snsapi_base' : 'snsapi_userinfo'; $oAuthUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$this->appId}&redirect_uri={$redirectUrl}&response_type=code&scope=$scope&state=$state"; return $oAuthUrl; } 獲取code的Model代碼
取得code的Model程式碼
?
這裡附上請(qǐng)求參數(shù)說明和回傳值說明
請(qǐng)求參數(shù)說明:
?
回應(yīng)回傳值說明:
?
# 當(dāng)請(qǐng)求成功,會(huì)redirect到請(qǐng)求參數(shù)中的redirect_uri的值中去,其實(shí)又回到weixin.php的$this->userInfo = $this->getWxUserInfo();這行去,然後再一次進(jìn)入到getWxUserInfo()方法,此時(shí)
//獲取授權(quán)臨時(shí)票據(jù)(code) $code = $_GET['code'];
?這行也已經(jīng)能取得得到code的值了。接著進(jìn)行第二步。
?
2、透過code取得access_token
weixin.php
userInfo = $this->getWxUserInfo(); } /** * 確保當(dāng)前用戶是在微信中打開,并且獲取用戶信息 * * @param string $url 獲取到微信授權(quán)臨時(shí)票據(jù)(code)回調(diào)頁面的URL */ private function getWxUserInfo($url = '') { //微信標(biāo)記(自己創(chuàng)建的) $wxSign = $this->input->cookie('wxSign'); //先看看本地cookie里是否存在微信唯一標(biāo)記, //假如存在,可以通過$wxSign到redis里取出微信個(gè)人信息(因?yàn)樵诘谝淮稳〉轿⑿艂€(gè)人信息,我會(huì)將其保存一份到redis服務(wù)器里緩存著) if (!empty($wxSign)) { //如果存在,則從Redis里取出緩存了的數(shù)據(jù) $userInfo = $this->model->redisCache->getData("weixin:sign_{$wxSign}"); if (!empty($userInfo)) { //獲取用戶的openid $this->wxId = $userInfo['openid']; //將其存在cookie里 $this->input->set_cookie('wxId', $this->wxId, 60*60*24*7); return $userInfo; } } //獲取授權(quán)臨時(shí)票據(jù)(code) $code = $_GET['code']; if (empty($code)) { if (empty($url)) { $url = rtirm($_SERVER['QUERY_STRING'], '/'); //到WxModel.php里獲取到微信授權(quán)請(qǐng)求URL,然后redirect請(qǐng)求url redirect($this->model->wx->getOAuthUrl(baseUrl($url))); } } /***************這里開始第二步:通過code獲取access_token****************/ $result = $this->model->wx->getOauthAccessToken($code); //如果發(fā)生錯(cuò)誤 if (isset($result['errcode'])) { return array('msg'=>'授權(quán)失敗,請(qǐng)聯(lián)系客服','result'=>$result); } //到這一步就說明已經(jīng)取到了access_token $this->wxId = $result['openid']; $accessToken = $result['access_token']; $openId = $result['openid']; //將openid和accesstoken存入cookie中 $this->input->set_cookie('wx_id', $this->wxId, 60*60*24*7); $this->input->set_cookie('access_token', $accessToken); 獲取access_token的控制器代碼
取得access_token的控制器程式碼
# WxModel.php
<?php class WxModel extends ModelBase{ public $appId; public $appSecret; public $token; public function __construct() { parent::__construct(); //審核通過的移動(dòng)應(yīng)用所給的AppID和AppSecret $this->appId = 'wx0000000000000000'; $this->appSecret = '00000000000000000000000000000'; $this->token = '00000000'; } /** * 獲取微信授權(quán)url * @param string 授權(quán)后跳轉(zhuǎn)的URL * @param bool 是否只獲取openid,true時(shí),不會(huì)彈出授權(quán)頁面,但只能獲取用戶的openid,而false時(shí),彈出授權(quán)頁面,可以通過openid獲取用戶信息 * */ public function getOAuthUrl($redirectUrl, $openIdOnly, $state = '') { $redirectUrl = urlencode($redirectUrl); $scope = $openIdOnly ? 'snsapi_base' : 'snsapi_userinfo'; $oAuthUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$this->appId}&redirect_uri={$redirectUrl}&response_type=code&scope=$scope&state=$state#wechat_redirect"; return $oAuthUrl; } /** * 獲取access_token */ public function getoAuthAccessToken($code) { return json_decode(file_get_contents("https://api.weixin.qq.com/sns/oauth2/access_token?appid={$this->AppId}&secret={$this->AppSecret}&code={$authCode}&grant_type=authorization_code",true); } 獲取access_token的Model代碼
取得access_token的Model程式碼
這裡附上參數(shù)說明
請(qǐng)求參數(shù)說明:
?
回應(yīng)回傳值說明:
當(dāng)回傳錯(cuò)誤時(shí)是這樣子的:
##?
取得access_token後,進(jìn)行介面調(diào)用,有下列前提:
?。?) access_tokec有效且未逾時(shí);
(2)微信使用者已授權(quán)給第三方應(yīng)用帳號(hào)對(duì)應(yīng)的介面作用域(scope)。
?
以下是取得使用者資訊的程式碼
weixin.phpuserInfo = $this->getWxUserInfo();
}
/**
* 確保當(dāng)前用戶是在微信中打開,并且獲取用戶信息
*
* @param string $url 獲取到微信授權(quán)臨時(shí)票據(jù)(code)回調(diào)頁面的URL
*/
private function getWxUserInfo($url = '') {
//微信標(biāo)記(自己創(chuàng)建的)
$wxSign = $this->input->cookie('wxSign');
//先看看本地cookie里是否存在微信唯一標(biāo)記,
//假如存在,可以通過$wxSign到redis里取出微信個(gè)人信息(因?yàn)樵诘谝淮稳〉轿⑿艂€(gè)人信息,我會(huì)將其保存一份到redis服務(wù)器里緩存著)
if (!empty($wxSign)) {
//如果存在,則從Redis里取出緩存了的數(shù)據(jù)
$userInfo = $this->model->redisCache->getData("weixin:sign_{$wxSign}");
if (!empty($userInfo)) {
//獲取用戶的openid
$this->wxId = $userInfo['openid'];
//將其存在cookie里
$this->input->set_cookie('wxId', $this->wxId, 60*60*24*7);
return $userInfo;
}
}
//獲取授權(quán)臨時(shí)票據(jù)(code)
$code = $_GET['code'];
if (empty($code)) {
if (empty($url)) {
$url = rtirm($_SERVER['QUERY_STRING'], '/');
//到WxModel.php里獲取到微信授權(quán)請(qǐng)求URL,然后redirect請(qǐng)求url
redirect($this->model->wx->getOAuthUrl(baseUrl($url)));
}
}
/***************這里開始第二步:通過code獲取access_token****************/
$result = $this->model->wx->getOauthAccessToken($code);
//如果發(fā)生錯(cuò)誤
if (isset($result['errcode'])) {
return array('msg'=>'授權(quán)失敗,請(qǐng)聯(lián)系客服','result'=>$result);
}
//到這一步就說明已經(jīng)取到了access_token
$this->wxId = $result['openid'];
$accessToken = $result['access_token'];
$openId = $result['openid'];
//將openid和accesstoken存入cookie中
$this->input->set_cookie('wx_id', $this->wxId, 60*60*24*7);
$this->input->set_cookie('access_token', $accessToken);
/*******************這里開始第三步:通過access_token調(diào)用接口,取出用戶信息***********************/
$this->userInfo = $this->model->wx->getUserInfo($openId, $accessToken);
//自定義微信唯一標(biāo)識(shí)符
$wxSign =substr(md5($this->wxId.'k2a5dd'), 8, 16);
//將其存到cookie里
$this->input->set_cookie('wxSign', $wxSign, 60*60*24*7);
//將個(gè)人信息緩存到redis里
$this->library->redisCache->set("weixin:sign_{$wxSign}", $userInfo, 60*60*24*7);
return $userInfo;
}
}
?>
獲取用戶信息的Controller
WxModel.php<?php
class WxModel extends ModelBase{
public $appId;
public $appSecret;
public $token;
public function __construct() {
parent::__construct();
//審核通過的移動(dòng)應(yīng)用所給的AppID和AppSecret
$this->appId = 'wx0000000000000000';
$this->appSecret = '00000000000000000000000000000';
$this->token = '00000000';
}
/**
* 獲取微信授權(quán)url
* @param string 授權(quán)后跳轉(zhuǎn)的URL
* @param bool 是否只獲取openid,true時(shí),不會(huì)彈出授權(quán)頁面,但只能獲取用戶的openid,而false時(shí),彈出授權(quán)頁面,可以通過openid獲取用戶信息
*
*/
public function getOAuthUrl($redirectUrl, $openIdOnly, $state = '') {
$redirectUrl = urlencode($redirectUrl);
$scope = $openIdOnly ? 'snsapi_base' : 'snsapi_userinfo';
$oAuthUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$this->appId}&redirect_uri={$redirectUrl}&response_type=code&scope=$scope&state=$state#wechat_redirect";
return $oAuthUrl;
}
/**
* 獲取access_token
*/
public function getoAuthAccessToken($code) {
return json_decode(file_get_contents("https://api.weixin.qq.com/sns/oauth2/access_token?appid={$this->AppId}&secret={$this->AppSecret}&code={$authCode}&grant_type=authorization_code",true);
}
/**
* 獲取用戶信息
*/
public function getUserInfo($openId, $accessToken) {
$url = 'https://api.weixin.qq.com/sns/userinfo';
//獲取用戶微信賬號(hào)信息
$userInfo = $this->callApi("$url?access_token=$accessToken&openid=$openId&lang=zh-CN");
if ($userInfo['errcode']) {
return array('msg'=>'獲取用戶信息失敗,請(qǐng)聯(lián)系客服', $userInfo);
}
$userInfo['wx_id'] = $openId;
return $userInfo;
}
/**
* 發(fā)起Api請(qǐng)求,并獲取返回結(jié)果
* @param string 請(qǐng)求URL
* @param mixed 請(qǐng)求參數(shù) (array|string)
* @param string 請(qǐng)求類型 (GET|POST)
* @return array
*/
public function callApi($apiUrl, $param = array(), $method = 'GET') {
$result = curl_request_json($error, $apiUrl, $params, $method);
//假如返回的數(shù)組有錯(cuò)誤碼,或者變量$error也有值
if (!empty($result['errcode'])) {
$errorCode = $result['errcode'];
$errorMsg = $result['errmsg'];
} else if ($error != false) {
$errorCode = $error['errorCode'];
$errorMsg = $error['errorMessage'];
}
if (isset($errorCode)) {
//將其插入日志文件
file_put_contents("/data/error.log", "callApi:url=$apiUrl,error=[$errorCode]$errorMsg");
if ($errorCode === 40001) {
//嘗試更正access_token后重試
try {
$pos = strpos(strtolower($url), 'access_token=');
if ($pos !==false ) {
$pos += strlen('access_token=');
$pos2 = strpos($apiUrl, '&' ,$pos);
$accessTokened = substr($apiUrl, $pos, $pos2 === false ? null : ($pos2 - $pos));
return $this->callApi(str_replace($accessTokened, $this->_getApiToken(true), $apiUrl), $param, $method);
}
}catch (WeixinException $e) {
}
}
//這里拋出異常,具有的就不詳說了
throw new WeixinException($errorMessage, $errorCode);
}
return $result;
}
/**
* 獲取微信 api 的 access_token 。 不同于 OAuth 中的 access_token ,參見 http://mp.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96access_token
*
* @param bool 是否強(qiáng)制刷新 accessToken
*/
private function _getApiToken($forceRefresh = false) {
//先查看一下redis里是否已經(jīng)緩存過access_token
$accessToken = $this->library->redisCache->get('Weixin:AccessToken');
if($forceRefresh || empty($accessToken)) {
$result = $this->callApi("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$this->appId}&secret={$this->appSecret}");
$accessToken = $result['access_token'];
$expire = max(1, intval($result['expires_in']) - 60);
//將access_token緩存到redis里去
$this->library->redisCache->set('Weixin:AccessToken', $accessToken, $expire);
}
return $accessToken;
}
?>
Common.php 透過以上三步驟呼叫接口,就可以取得到使用者的微信帳號(hào)資訊了。 更多微信授權(quán)登入並取得使用者資訊介面相關(guān)文章請(qǐng)關(guān)注PHP中文網(wǎng)! <?php
/**
* 發(fā)起一個(gè)HTTP(S)請(qǐng)求,并返回json格式的響應(yīng)數(shù)據(jù)
* @param array 錯(cuò)誤信息 array($errorCode, $errorMessage)
* @param string 請(qǐng)求Url
* @param array 請(qǐng)求參數(shù)
* @param string 請(qǐng)求類型(GET|POST)
* @param int 超時(shí)時(shí)間
* @param array 額外配置
*
* @return array
*/
public function curl_request_json(&$error, $url, $param = array(), $method = 'GET', $timeout = 10, $exOptions = null) {
$error = false;
$responseText = curl_request_text($error, $url, $param, $method, $timeout, $exOptions);
$response = null;
if ($error == false && $responseText > 0) {
$response = json_decode($responseText, true);
if ($response == null) {
$error = array('errorCode'=>-1, 'errorMessage'=>'json decode fail', 'responseText'=>$responseText);
//將錯(cuò)誤信息記錄日志文件里
$logText = "json decode fail : $url";
if (!empty($param)) {
$logText .= ", param=".json_encode($param);
}
$logText .= ", responseText=$responseText";
file_put_contents("/data/error.log", $logText);
}
}
return $response;
}
/**
* 發(fā)起一個(gè)HTTP(S)請(qǐng)求,并返回響應(yīng)文本
* @param array 錯(cuò)誤信息 array($errorCode, $errorMessage)
* @param string 請(qǐng)求Url
* @param array 請(qǐng)求參數(shù)
* @param string 請(qǐng)求類型(GET|POST)
* @param int 超時(shí)時(shí)間
* @param array 額外配置
*
* @return string
*/
public function curl_request_text(&$error, $url, $param = array(), $method = 'GET', $timeout = 15, $exOptions = NULL) {
//判斷是否開啟了curl擴(kuò)展
if (!function_exists('curl_init')) exit('please open this curl extension');
//將請(qǐng)求方法變大寫
$method = strtoupper($method);
$ch = curl_init();
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_HEADER, false);
if (isset($_SERVER['HTTP_USER_AGENT'])) curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
if (isset($_SERVER['HTTP_REFERER'])) curl_setopt($ch, CURLOPT_REFERER, $_SERVER['HTTP_REFERER']);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
switch ($method) {
case 'POST':
curl_setopt($ch, CURLOPT_POST, true);
if (!empty($param)) {
curl_setopt($ch, CURLOPT_POSTFIELDS, (is_array($param)) ? http_build_query($param) : $param);
}
break;
case 'GET':
case 'DELETE':
if ($method == 'DELETE') {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
}
if (!empty($param)) {
$url = $url.(strpos($url, '?') ? '&' : '?').(is_array($param) ? http_build_query($param) : $param);
}
break;
}
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_URL, $url);
//設(shè)置額外配置
if (!empty($exOptions)) {
foreach ($exOptions as $k => $v) {
curl_setopt($ch, $k, $v);
}
}
$response = curl_exec($ch);
$error = false;
//看是否有報(bào)錯(cuò)
$errorCode = curl_errno($ch);
if ($errorCode) {
$errorMessage = curl_error($ch);
$error = array('errorCode'=>$errorCode, 'errorMessage'=>$errorMessage);
//將報(bào)錯(cuò)寫入日志文件里
$logText = "$method $url: [$errorCode]$errorMessage";
if (!empty($param)) $logText .= ",$param".json_encode($param);
file_put_contents('/data/error.log', $logText);
}
curl_close($ch);
return $response;
}
?>
取得使用者資訊的自訂函數(shù)

熱AI工具

Undress AI Tool
免費(fèi)脫衣圖片

Undresser.AI Undress
人工智慧驅(qū)動(dòng)的應(yīng)用程序,用於創(chuàng)建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費(fèi)的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

記事本++7.3.1
好用且免費(fèi)的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強(qiáng)大的PHP整合開發(fā)環(huán)境

Dreamweaver CS6
視覺化網(wǎng)頁開發(fā)工具

SublimeText3 Mac版
神級(jí)程式碼編輯軟體(SublimeText3)

PHP是一種開源的腳本語言,廣泛應(yīng)用於網(wǎng)頁開發(fā)和伺服器端編程,尤其在微信開發(fā)中得到了廣泛的應(yīng)用。如今,越來越多的企業(yè)和開發(fā)者開始使用PHP進(jìn)行微信開發(fā),因?yàn)樗蔀榱苏嬲囊讓W(xué)易用的開發(fā)語言。在微信開發(fā)中,訊息的加密和解密是一個(gè)非常重要的問題,因?yàn)樗鼈兩婕百Y料的安全性。對(duì)於沒有加密和解密方式的消息,駭客可以輕鬆取得其中的數(shù)據(jù),對(duì)用戶造成威脅

在微信公眾號(hào)開發(fā)中,投票功能經(jīng)常被運(yùn)用。投票功能是讓使用者快速參與互動(dòng)的好方式,也是舉辦活動(dòng)和調(diào)查意見的重要工具。本文將為您介紹如何使用PHP實(shí)作微信投票功能。在取得微信公眾號(hào)授權(quán)首先,你需要取得微信公眾號(hào)的授權(quán)。在微信公眾平臺(tái)上,你需要設(shè)定微信公眾號(hào)碼的api地址、官方帳號(hào)和公眾號(hào)碼對(duì)應(yīng)的token。在我們使用PHP語言開發(fā)的過程中,我們需要使用微信官方提供的PH

隨著微信的普及,越來越多的企業(yè)開始將其作為行銷工具。而微信群發(fā)功能,則是企業(yè)進(jìn)行微信行銷的重要手段之一。但是,如果只依靠手動(dòng)發(fā)送,對(duì)於行銷人員來說是一件極為費(fèi)時(shí)費(fèi)力的工作。所以,開發(fā)一款微信群發(fā)工具就顯得格外重要。本文將介紹如何使用PHP開發(fā)微信群發(fā)工具。一、準(zhǔn)備工作開發(fā)微信群發(fā)工具,我們需要掌握以下幾個(gè)技術(shù)點(diǎn):PHP基礎(chǔ)知識(shí)微信公眾平臺(tái)開發(fā)開發(fā)工具:Sub

微信是目前全球用戶規(guī)模最大的社群平臺(tái)之一,隨著行動(dòng)網(wǎng)路的普及,越來越多的企業(yè)開始意識(shí)到微信行銷的重要性。在進(jìn)行微信行銷時(shí),客服服務(wù)是至關(guān)重要的一環(huán)。為了更好地管理客服聊天窗口,我們可以藉助PHP語言進(jìn)行微信開發(fā)。一、PHP微信開發(fā)簡(jiǎn)介PHP是一種開源的伺服器端腳本語言,廣泛用於Web開發(fā)領(lǐng)域。結(jié)合微信公眾平臺(tái)提供的開發(fā)接口,我們可以使用PHP語言進(jìn)行微信

在微信公眾號(hào)開發(fā)中,使用者標(biāo)籤管理是一個(gè)非常重要的功能,可以讓開發(fā)者更了解和管理自己的使用者。本篇文章將介紹如何使用PHP實(shí)作微信使用者標(biāo)籤管理功能。一、取得微信用戶openid在使用微信用戶標(biāo)籤管理功能之前,我們首先需要取得用戶的openid。在微信公眾號(hào)開發(fā)中,透過使用者授權(quán)的方式取得openid是比較常見的做法。在使用者授權(quán)完成後,我們可以透過以下程式碼取得用

隨著微信成為了人們生活中越來越重要的通訊工具,其敏捷的訊息傳遞功能迅速受到廣大企業(yè)和個(gè)人的青睞。對(duì)企業(yè)而言,將微信發(fā)展為一個(gè)行銷平臺(tái)已經(jīng)成為趨勢(shì),而微信開發(fā)的重要性也逐漸凸顯。在其中,群發(fā)功能更是被廣泛使用,那麼,作為PHP程式設(shè)計(jì)師,如何實(shí)現(xiàn)群發(fā)訊息發(fā)送記錄呢?以下將為大家簡(jiǎn)單介紹一下。 1.了解微信公眾號(hào)相關(guān)開發(fā)知識(shí)在了解如何實(shí)現(xiàn)群發(fā)訊息發(fā)送記錄之前,我

如何使用PHP實(shí)現(xiàn)微信公眾號(hào)開發(fā)微信公眾號(hào)已經(jīng)成為了許多企業(yè)推廣和互動(dòng)的重要管道,而PHP作為常用的Web語言,也可以用來進(jìn)行微信公眾號(hào)的開發(fā)。本文將介紹使用PHP實(shí)現(xiàn)微信公眾號(hào)開發(fā)的具體步驟。第一步:取得微信公眾號(hào)的開發(fā)者帳號(hào)在開始微信公眾號(hào)開發(fā)之前,需要先去申請(qǐng)一個(gè)微信公眾號(hào)的開發(fā)者帳號(hào)。具體的註冊(cè)流程可參考微信公眾平臺(tái)的官方網(wǎng)

隨著網(wǎng)路和行動(dòng)智慧型裝置的發(fā)展,微信成為了社交和行銷領(lǐng)域不可或缺的一部分。在這個(gè)越來越數(shù)位化的時(shí)代,如何使用PHP進(jìn)行微信開發(fā)已經(jīng)成為了許多開發(fā)者的關(guān)注點(diǎn)。本文主要介紹如何使用PHP進(jìn)行微信發(fā)展的相關(guān)知識(shí)點(diǎn),以及其中的一些技巧和注意事項(xiàng)。一、開發(fā)環(huán)境準(zhǔn)備在進(jìn)行微信開發(fā)之前,首先需要準(zhǔn)備好對(duì)應(yīng)的開發(fā)環(huán)境。具體來說,需要安裝PHP的運(yùn)作環(huán)境,以及微信公眾平臺(tái)提
