I built a WeiPHP framework application (called A) on Sina SAE, built a WeChat wall function, and wanted to display the WeChat wall content through a front-end web page instead of through the WeiPHP framework. This requires authorizing the database of the WeiPHP framework application to the application of this web site (called B).
1. Database authorization
(1) Enter database management and click on cross-application authorization
(2) Authorize the database of application A to application B, click Authorize
2. Write the script to connect to the database of application B
(1) Modify file: index.php
(2) Parameter meaning:
Main database domain name: SAE_MYSQL_HOST_M
Slave database domain name: SAE_MYSQL_HOST_S
Port: SAE_MYSQL_PORT
Username: SAE_MYSQL_USER (Access Key)
Password: SAE_MYSQL_PASS (Secret Key)
Database name: SAE_MYSQL_DB
3. View the results:
Web page display:
helloworld
4.Attention
If SAE_MYSQL_USER and SAE_MYSQL_PASS are filled in incorrectly, the web page will display the following information:
Warning: mysql_connect() [function.mysql-connect]: this app is not authorized in index.php on line 6
Author: Jackson Source: Huang Zhe’s blog http://www.cnblogs.com/jackson0714/p/4376000.html
The above introduces [WeChat Development] 01. Database authorization and connection, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.