Heim  >  Artikel  >  php教程  >  【微信开发】01.数据库授权和连接,01数据库授权

【微信开发】01.数据库授权和连接,01数据库授权

WBOY
WBOYOriginal
2016-06-13 09:08:591365Durchsuche

【微信开发】01.数据库授权和连接,01数据库授权

在新浪SAE上面搭建了一个WeiPHP框架应用(称作A),做了一个微信墙的功能,想通过一个前端web页面显示微信墙内容,而不是通过WeiPHP框架。这就需要将WeiPHP框架应用的数据库授权给这个web站点的应用(称作B)。

1. 数据库授权

(1)进入数据库管理,点击跨应用授权

 (2)将A应用的数据库授权给B应用,点击授权

2.编写B应用的连接数据库的脚本

(1)修改文件:index.php
(2)参数含义:

主库域名 : SAE_MYSQL_HOST_M
从库域名 : SAE_MYSQL_HOST_S
端  口 : SAE_MYSQL_PORT 用户名  : SAE_MYSQL_USER(Access Key)
密  码 : SAE_MYSQL_PASS(Secret Key)
数据库名 : SAE_MYSQL_DB

 

3.查看结果:

网页显示:

helloworld

 

4.注意

如果SAE_MYSQL_USER和SAE_MYSQL_PASS填写的不正确,网页将会显示以下信息:

Warning: mysql_connect() [function.mysql-connect]: this app is not authorised in index.php on line 6

 

作者:Jackson 出处:黄哲同学的博客http://www.cnblogs.com/jackson0714/p/4376000.html 

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn