Home > Article > Backend Development > php WeChat public account js-sdk development application_php example
To test the interface function of js, I used BAE server not SAE server. The SAE server cannot write files and there will be problems with the test.
What is js-sdk? Let me first demonstrate the specific function of the js-sdk interface.
I randomly opened a push article on WeChat as shown below:
Click on the first article
The above is our connected article. If we send this article to a friend , the display effect is as follows:
Share to Moments and let’s take a look at the effect:
Why is the interface effect displayed in the official account, send to friends, and send to Moments when it is also an article link? no the same. The display effect of the official account is because the WeChat official account calls the WeChat message interface when pushing, and the latter two are because the page calls the SDK interface related to js-sdk.
Send to friends calls the js interface to obtain the "Share to Friends" button click status and customize the sharing content interface.
Send to Moments calls the js interface to obtain the click status of the "Share to Moments" button and customize the sharing content interface.
Let’s implement the steps to call the js-sdk interface:
Step 1: Enter the "Function Settings" of the "Official Account Settings" on the WeChat public platform and fill in the "JS Interface Security Domain Name".
As shown below:
Only pages placed under this domain name can call the js interface.
Step 2:
http://demo.open.weixin.qq.com/jssdk/sample.zip Connect to this address to download, open the php folder inside, and you will find 4 php files
GetSignPackage();//获取配置参数。 ?>
我靠猪八戒你好唐生🎜