gpt4 book ai didi

php - 如何在 DSN 中指定用户名和密码?

转载 作者:行者123 更新时间:2023-12-02 00:00:10 24 4
gpt4 key购买 nike

PDO DSN 的官方文档页面尚未列出用户名或密码。这些键值对的正确名称是什么?

最佳答案

看起来文档还没有更新,但是this is the related change来自 PHP 的源存储库,说明了应该如何使用它:

  • PDO: The username and password can now be specified as part of the PDO DSN forthe mysql, mssql, sybase, dblib, firebird and oci drivers. Previously thiswas only supported by the pgsql driver. If a username/password is specifiedboth in the constructor and the DSN, the constructor takes precedence.

      new PDO("mysql:host=xxx;port=xxx;dbname=xxx;user=xxx;password=xxx");

这是 associated pull request .

关于php - 如何在 DSN 中指定用户名和密码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59448952/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com