【问题标题】:using xeround, heroku, php使用 xeround、heroku、php
【发布时间】:2012-08-15 18:54:36
【问题描述】:

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

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

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

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

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

提前致谢!

【问题讨论】:

    标签: 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]

    希望对你有帮助:)

    【讨论】:

      猜你喜欢
      • 2012-09-21
      • 1970-01-01
      • 2011-12-17
      • 2013-03-27
      • 1970-01-01
      • 2012-04-28
      • 2016-10-25
      • 2013-02-03
      • 2018-01-04
      相关资源
      最近更新 更多