欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

微網(wǎng)站制作教程圖解

2023-01-23    分類: 網(wǎng)站制作

創(chuàng)新互聯(lián)網(wǎng)站制作公司最近發(fā)現(xiàn)特別多的人在問微網(wǎng)站是什么,微網(wǎng)站有什么用,微網(wǎng)站怎么做,微網(wǎng)站建設流程等問題,今天,在這里為大家統(tǒng)一解答,希望能對各位愛學習人士有所幫助。
第一步:首先,需要在微信公眾平臺上注冊一個自己的服務號或者訂閱號。
微<a href=網(wǎng)站制作教程圖解1:注冊自己的服務號或者訂閱號" src="/upload/pic19/1439353032.jpg" />
第二步:申請公眾賬號成功后,便可以使用其基本功能了,當然,要想做成自己的微信官網(wǎng),則需要進入開發(fā)模式,接入第三方接口。
微網(wǎng)站制作教程圖解2微網(wǎng)站制作圖解3微官網(wǎng)
第三步:注冊成功并登陸第三方接口,將注冊好的微信公眾號添加到第三方接口上,所需信息在微信公眾號設置下的賬號信息里。
注冊成功并登陸第三方接口
第四步:添加公眾賬號后,連接公眾平臺與第三方接口,如圖:登錄微信公眾平臺,點擊最左側(cè)最下方的【開發(fā)者中心】,點擊開發(fā)模式。
登錄微信公眾平臺
第五步:最后,設計自己的微信官網(wǎng)。并且可在線預覽。

完成以上步驟后,并且認證訂閱號或服務號后就可以做微信的二次開發(fā)了,比如我要制作一個群發(fā)功能的接口,需要使用一下微信接口:
1、獲取access token
2、新增臨時素材接口
3、上傳圖文消息素材接口
4、調(diào)用群發(fā)接口
接口代碼示例:WeixinApi.class.php
class WeixinApi{
private $appid,$appsecret,$media_id;
public function __construct($appid="",$appsecret=""){
$this->appid=$appid;
$this->appsecret=$appsecret;
}
//獲取token
public function getToken(){
if($_COOKIE["exptime"]=="" || time()-$_COOKIE["create_time"]>=$_COOKIE["exptime"]){
$token=@file_get_contents("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$this->appid}&secret={$this->appsecret}");
$tokenarr=json_decode($token,true);
setcookie("exptime",$tokenarr["expires_in"],0,'/');
setcookie("access_token",$tokenarr["access_token"],0,'/');
setcookie("create_time",time(),0,'/');
}else{
$tokenarr=array(
"access_token"=>$_COOKIE["access_token"],
"expires_in"=>$_COOKIE["exptime"],
"create_time"=>$_COOKIE["create_time"]
);
}
return $tokenarr;
}
private function sockupload($phost,$pport,$purl,$filename,$file_data=array()){
$host = $phost;
$port = $pport;
$errno = '';
$errstr = '';
$timeout = 30;
$url = $purl;
/*$form_data = array(
'name' => 'lijie',
'gender' => 'man',
);*/
$file_data = array(
array(
'name' => 'media',
'filename' => $filename,
//'path' =>'1.jpg'
)
);
// create connect
$fp = fsockopen($host, $port, $errno, $errstr, $timeout);
if(!$fp){
return false;
}
// send request
srand((double)microtime()*1000000);
$boundary = "---------------------------".substr(md5(rand(0,32000)),0,10);
$data = "--$boundaryrn";
// form data
if(count($form_data)>0){
foreach($form_data as $key=>$val){
$data .= "Content-Disposition: form-data; name="".$key.""rn";
$data .= "Content-type:text/plainrnrn";
$data .= rawurlencode($val)."rn";
$data .= "--$boundaryrn";
}
}
// file data
if($filename!=""){
foreach($file_data as $file){
$data .= "Content-Disposition: form-data; name="".$file['name'].""; filename="".$file['filename'].""rn";
$pinfo=pathinfo($file['filename']);
$data .= "Content-Type: ".$pinfo["extension"]."rnrn";
$data .= implode("",file($file['filename']))."rn";
$data .= "--$boundaryrn";
}
}
$data .="--rnrn";
$out = "POST ${url} HTTP/1.1rn";
$out .= "Host:${host}rn";
$out .= "Content-type:multipart/form-data; boundary=$boundaryrn"; // multipart/form-data
$out .= "Content-length:".strlen($data)."rn";
$out .= "Connection:closernrn";
$out .= "${data}";
fputs($fp, $out);
// get response
$response = '';
while($row=fread($fp, 4096)){
$response .= $row;
}
$pos = strpos($response, "rnrn");
$response = substr($response, $pos+4);
return $response;
}
//json數(shù)據(jù)提交
private function jsonUpload($url,$jsdata){
$data_string = $jsdata;
$ch = curl_init();
curl_setopt ( $ch, CURLOPT_URL, $url );
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json;charset=utf-8',
'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);
curl_close ( $ch );
return $result;
}
//上傳媒體接口
public function upload($type,$filename){
$tokens=$this->getToken();
$result=$this->sockupload("api.weixin.qq.com",80,"/cgi-bin/media/upload?access_token=".$tokens["access_token"]."&type={$type}",$filename);
$media=json_decode($result,true);
$this->media_id=$media['media_id'];
return $this;
}
//上傳素材
public function uploadnews($title,$content,$author="",$url="",$digest="",$show_cover_pic="1"){
$articles=array(
"articles"=>array(
array(
"thumb_media_id"=>$this->media_id,
"author"=>$author,
"title"=>urlencode($title),
"content_source_url"=>$url,
"content"=>urlencode($content),
"digest"=>$digest,
"show_cover_pic"=>"1"
)
)
);
$tokens=$this->getToken();
$news=urldecode(json_encode($articles));
$result=$this->jsonUpload("api.weixin.qq.com/cgi-bin/media/uploadnews?access_token=".$tokens["access_token"]."",$news);
$newsdata=json_decode($result,true);
$this->media_id=$newsdata["media_id"];
return $this;
}
//群發(fā)接口
public function sendall(){
$arr=array(
"filter"=>array("is_to_all"=>true,"group_id"=>""),
"mpnews"=>array("media_id"=>$this->media_id),
"msgtype"=>"mpnews"
);
$json=json_encode($arr);
$tokens=$this->getToken();
$result=$this->jsonUpload("api.weixin.qq.com/cgi-bin/message/mass/sendall?access_token=".$tokens["access_token"]."",$json);
return $result;
}
}
使用:
$weixin=new WeixinApi($appid,$appsecret);
$result=$weixin->upload("image","圖片路徑")->uploadnews("文章標題","文章內(nèi)容")->sendall();

網(wǎng)頁標題:微網(wǎng)站制作教程圖解
標題路徑:http://aaarwkj.com/news/231964.html

網(wǎng)站建設、網(wǎng)絡推廣公司-創(chuàng)新互聯(lián),是專注品牌與效果的網(wǎng)站制作,網(wǎng)絡營銷seo公司;服務項目有網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站建設網(wǎng)站維護公司
亚洲午夜av久久乱码| 日本国产一区二区三区在线| 中文字幕精品人妻丝袜| 成人免费激情在线观看| 在线天堂一区二区三区| 日韩一区不卡在线观看| 久久精品国产普通话对白| 日韩精品中文女同在线播放| 激情五月,开心五月深情五月| 欧美精品一区二区久久不卡| 漂亮人妻被中出中文字幕| 中文字幕日韩欧美一区在线| 亚洲精品一区二区三区pp| 麻豆精品情欲人妻二区| 日本欧美亚洲一区二区三区| 亚洲 综合 久久久| 国产精品国产自产拍高清| 91亚洲精品综合久久| 日本乱码中文字幕在线观看| 亚洲天堂av在线播放| 丝袜美腿蜜汁一龙二凤| 超碰av之男人的天堂| 国产一区二区精品久久岳√| 日本熟妇色在线视频不卡| 亚洲国产中文一区二区久久| 中文字幕的国产在线播放| 自偷自拍亚洲综合精品| 亚洲激情午夜福利视频| 欧美日韩亚洲精品三级| 亚洲另类熟女国产精品老| 国产精品免费视频一区二区三区| 丰满少妇被激烈的插进去| 国产人妖cd蜜雅丝袜美女| 日本韩国精品视频在线| 国产精品18禁一区二区三区| 欧美激情网页一区三区| 亚洲美腿丝袜综合在线| 亚洲社区一区二区三区四区| 91桃色午夜福利视频| 国产精品大全中文字幕| 亚洲av中文久久精品国内|