English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

How to Customize WeChat Sharing Description Content in thinkphp Project

This article mainly discusses: how to obtain the WeChat sharing interface permission in the thinkphp framework, how to set the safe domain name, how to modify the WeChat sharing title, description, image, and how to customize the WeChat sharing content.

Example after modification:http://games.zixuephp.cn

Below is the comparison chart of the effect of modifying the WeChat share title, WeChat share description, WeChat share image, and not modifying it:

The effect of the WeChat share without modification is as shown below: the share content is the URL path of the shared page.

The effect of modifying the WeChat share content is as shown below: the share content is customized content.

1Necessary condition: authenticated WeChat official account.

2In the WeChat official account management background, click on the official account settings, enter the function settings, select the JS interface security domain, download the txt format of the authentication file and place it in the root directory of the website, then return to the WeChat official account background management page, confirm the authentication, fill in the domain name of the site with sharing, and save.

3Download the WeChat jssdk interface file package. Download address: link:http://pan.baidu.com/s/1eStCSXc Password:1p8k

4Configure the WeChat jssdk interface file package to the thinkphp extension directory, that is, configure to thinkphp/Extend/Vendor/Directory.

5From the WeChat official account background, obtain the appid and appsecret of the WeChat official account, and configure them to the configuration file of thinkphp.

6In the common.php file of thinkphp, define the WeChat initialization function: (the parameters in the case of the figure below should be obtained from the configuration file)

7In the class file that needs to use the customized WeChat share content, define the WeChat share content and then pass it to the template page:

Among them: is the custom title, brief is the custom WeChat share description content, picture is the custom WeChat share image path, is the custom link address after the share content is clicked.

8Then, in the page, introduce the js file and use the configuration parameters:

The above is the introduction of how to customize the WeChat share description content of the thinkphp project by the editor. I hope it will be helpful to everyone. If you have any questions, please leave a message, and the editor will reply to everyone in time. Also, I would like to express my sincere gratitude to everyone for their support of the Naoan tutorial website!

You May Also Like