using xeround, heroku, php


using xeround, heroku, php

我正在尝试使用 php 在 heroku 中开发一个 PHP 应用程序......

我已经使用链接完成了添加 - https://devcenter.heroku.com/articles/xeround#connecting-to-xeround。

现在,我试图查询数据库,只是一个简单的查询,但甚至没有显示任何错误。

我可以知道是否仍然需要连接字符串吗?如果需要,我可以知道作为主机放什么吗?

如果需要任何后续问题,请告诉我。

提前感谢!

你可以试试这个:

$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]

希望对:)有所帮助