_php example of the development and application of PHP micro-JS-SDK public number

Source: Internet
Author: User
Tags php code

Test JS interface function, I use the BAE server is not SAE server. The SAE server could not write to the file and the test would be problematic.
what is called Js-sdk, I first demonstrate the concrete function of the JS-SDK interface.

I open a piece of micro-letter to push the article the following figure:


Click to open the first article


Above is our connection article, if we send this article to a friend, the display effect is as follows:

Share to the circle of friends we'll see the effect:

Why is the same article connection, in the public number, sent to friends, sent to the circle of friends to show the effect of the interface is not the same. The public number was displayed because the micro-credit public account was invoked at the time of the push, and both were due to the JS-SDK associated SDK interface called by the page.
Send a friend to call the JS interface to get "share to Friends" button click State and custom sharing content interface.
Sent to the circle of friends to call the JS interface to get "share to Friend Circle" button click State and custom sharing content interface.

Let's implement the steps to invoke the JS-SDK interface:

The first step: micro-trust public platform into the "Public number settings" in the "Functional settings" fill in the "JS interface security Domain name."

The following figure:


Only pages placed under the domain name can call the JS interface.

Step Two:Http://demo.open.weixin.qq.com/jssdk/sample.zip connect this address to download, open inside the PHP folder, you found 4 php files


The first 3 PHP files are the configuration files, do not move it, sample.php is the Connection page we opened in the micro-letter, in this page we write our page code. This file I used to test, the inside of the code is different from the original.

<?php
//echo "Nihao";
Require_once "jssdk.php";
$JSSDK = new Jssdk ("wxaf471be5d2bc9521", "93F5C3817074D43E7A7AB3F403CC72DD"), and the parameters in//jssdk are AppID and Appsecret.
$signPackage = $jssdk->getsignpackage ();//Get configuration parameters.
?>
<! DOCTYPE html>  

Test JS interface function, I use the BAE server is not SAE server. The SAE server could not write to the file and the test would be problematic.
For more features and more information, please visit http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.