【问题标题】:Using a connection string where the password contains a "@" sign?使用密码包含“@”符号的连接字符串?
【发布时间】:2011-01-17 11:00:10
【问题描述】:

连接到数据库服务器端点时,使用如下连接字符串格式:

mongodb://username:password@server:port/database

如果密码中包含“@”符号,是否可以连接?

如果有,怎么做?

【问题讨论】:

  • 您是否尝试对@进行 url 编码?
  • 是的,尝试使用 %40。没用。 :(

标签: mongodb connection-string database


【解决方案1】:

如果您从Github 下载最新代码,您可以使用:

new Mongo("mongodb://host/db", array("username" => $username, "password" => $password));

【讨论】:

    猜你喜欢
    • 2010-11-28
    • 2014-11-04
    • 1970-01-01
    相关资源
    最近更新 更多