In two ways:
One is a small program code,
One is the two-dimensional code.
Applet code | Applet two-dimensional code |
---|
interface | getwxacode (Interface A) | getwxacodeunlimit(B) | createwxaqrcode(C) |
---|---|---|---|
the term | Permanent | Permanent | Permanent |
Quantity | A total of 100,000 C interface | unlimited | A total of 100,000 interface |
Parameter Description | longer path parameters, the maximum 128 bytes. Such as: Incoming "foo = bar?" | You can not carry parameters (parameters, please put scene field) call frequency: 5000 times / minute |
longer path parameters, the maximum 128 bytes. |
parameter | path (required): Go to page width: the width of the applet code |
scene (required): the above mentioned id = 261 & l_id = 598 Page: to enter the page, not with parameters |
path (required): Go to page width: the width of the two-dimensional code |
Successful return value | Return to image binary content | Return to image binary content | Return to image binary content |
Interface B (applet code) is called:
$url = 'https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=' . $access_token;
$data = array();
$data["scene"] = $scene; // $scene : id=261&s_id=5758&l_id=598
$data["page"] = $page;
$data["width"] = $width;
$json_data = json_encode($data);
$return = $this->request_post($url, $json_data);
// will generate a small program code into the appropriate folder
$imgname = time() . rand(10000, 99999) . '.jpg';
file_put_contents(IA_ROOT . "/upload/" . $imgname, $return);
Interface C (two-dimensional code) is called:
$url = 'https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=' . $access_token;
$data = array();
$data["path"] = "/home/index/index?id=" . $id;
$data["width"] = 300;
$json_data = json_encode($data);
$return = $this->request_post($url, $json_data);
.........