【问题标题】:using xeround, heroku, php使用 xeround、heroku、php
【发布时间】:2012-08-15 18:54:36
【问题描述】:
【问题讨论】:
标签:
php
mysql
heroku
xeround
【解决方案1】:
你可以试试这个:
$url=parse_url(getenv("DATABASE_URL"));
$server = $url["host"];
$username = $url["user"];
$password = $url["pass"];
$port = $url["port"];
$db = substr($url["path"],1);
$link = mysql_connect($server . ":" . $port, $username, $password);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
[来源:https://devcenter.heroku.com/articles/cleardb#using-cleardb-with-php]
希望对你有帮助:)