


The content of this article is about jumping to the designated WeChat scan code to follow the webpage (with code). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
Jump to the designated WeChat scan code to follow the web page, easily add friends and follow the public account
Sample code
The following code is only a pseudo code for demonstration. The interface needs to be implemented by the user.
Address Book Interface
Enterprise WeChat opens two permissions, the reading and editing permissions of the address book. The following is an example of adding a department (other interfaces are similar):
Step one: Get the access_token of the address book application
public function getAccessToken($corpid,$secret) { //TODO: access_token should be stored and updated globally, the following code is written to the file As an example //TODO: The access_token of each application should be stored independently. Here, secret is used as the identifier to distinguish the application. $path = "/cache/$secret.php"; $data = json_decode (get_php_file ($path)); if ($data->expire_time access_token; if ($access_token) { $data->expire_time = time() 7000; $data->access_token = $access_token; set_php_file( $path, json_encode($data)); } } else { $access_token = $data->access_token; } return $access_token; }
Step 2: Encapsulate the data package and send it to the enterprise WeChat backend
$info = $array("name" => "Add department name", "parentid" => 1, "order" => 10, "id" => 12); // TODO: Pass in your corporate corpid and the secret information of the address book application here $txl_access_token = getAccessToken("corpid","txl_secret"); print(http_post("https://qyapi.weixin.qq.com/cgi- bin/department/createac
The above is the complete introduction to jump to the WeChat designated scan code to follow the webpage (with code), if you want to know more aboutWeChat development graphic tutorial, please pay attention to the PHP Chinese website.
The above is the detailed content of Jump to the designated WeChat scan code to follow the webpage (with code). For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools