Home > php教程 > php手册 > PHP连接SAE平台MYSQL

PHP连接SAE平台MYSQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 09:51:26
Original
1453 people have browsed it
这些是SAE中用到的常量,不清楚时去你在SAE中创建应用可以找到:
Copy after login
SAE_MYSQL_USER:用户名<br>SAE_MYSQL_PASS:密码: <br>SAE_MYSQL_HOST_M:主库域名<br>SAE_MYSQL_HOST_S:从库域名 <br>SAE_MYSQL_PORT:端口: <br>SAE_MYSQL_DB数据库名
Copy after login
数据库连接:
Copy after login
$link = mysql_connect ( SAE_MYSQL_HOST_M . ':' . SAE_MYSQL_PORT, SAE_MYSQL_USER, SAE_MYSQL_PASS );
Copy after login

注意在数据库和页面的编码不一样时,取到的值或者是你的页面有乱码情况

解决如下:

<meta http-equiv="<span" style="color: #800000;">"<span style="color: #800000;">Content-Type</span><span style="color: #800000;">"</span> content=<span style="color: #800000;">"</span><span style="color: #800000;">text/html; charset=gbk</span><span style="color: #800000;">"</span> />
Copy after login
或者
Copy after login
mysql_set_charset("gbk");
Copy after login

完整代码:下面例子中红色部分为解决编码问题

<br><br><span style="color: #ff0000;"><meta http-equiv="Content-Type" content="text/html; charset=gbk"></span><br><br><br>    
Copy after login
"1">





/*
* SAE_MYSQL_USER:鐢ㄦ埛鍚
鐢ㄦ埛ID 鐢ㄦ埛鍚嶇О
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template