Shangpin ChinaWebsite productionRecently, the company found that many people were askingMicrositeToday, I'm here to give you a unified answer to the questions of what is the micro website, what is its use, how to do it, and the construction process of the micro website. I hope it can help you who love learning.
Step 1: First, you need to register a service number or subscription number on the WeChat public platform.
Step 2: After successfully applying for a public account, you can use its basic functions. Of course, if you want to build your own WeChat official website, you need to enter the development mode and access the third-party interface.
Step 3: Register successfully and log in to the third-party interface. Add the registered WeChat public account to the third-party interface. The required information is in the account information under the WeChat public account settings.
Step 4: After adding a public account, connect the public platform and the third-party interface, as shown in the figure: log in to the WeChat public platform, click the [Developer Center] at the bottom left, and click the development mode.
Step 5: Finally, design your own WeChat official website.And it can be previewed online.
After completing the above steps and authenticating the subscription number or service number, we can do the secondary development of WeChat. For example, if I want to create an interface for mass sending, I need to use the following WeChat interface:
1. Get access token
2. Add temporary material interface
3. Upload image and text message material interface
4. Call mass sending interface
Example of interface code: WeixinApi.class.php
<?php class WeixinApi{ private $appid,$appsecret,$media_id; public function __construct($appid="",$appsecret=""){ $this->appid=$appid; $this->appsecret=$appsecret; }
//Upload media interface 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; }
//Upload material 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" ) ) );