search
Homephp教程php手册PHP连接SAE平台MYSQL

PHP连接SAE平台MYSQL

Jun 06, 2016 am 09:51 AM
mysqlphpcodeplatformOpen sourceprogrammingprogramming languagesoftware developmentconnect

这些是SAE中用到的常量,不清楚时去你在SAE中创建应用可以找到:
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数据库名
数据库连接:
$link = mysql_connect ( SAE_MYSQL_HOST_M . ':' . SAE_MYSQL_PORT, SAE_MYSQL_USER, SAE_MYSQL_PASS );

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

解决如下:

<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> />
或者
mysql_set_charset("gbk");

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

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





/*
* SAE_MYSQL_USER:鐢ㄦ埛鍚
鐢ㄦ埛ID 鐢ㄦ埛鍚嶇О
Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!