我正试图将我的连接编码成UTF8。我在看其他的一些帖子,但是soe有一些原因它不起作用。不知道我做错了什么。
,这就是我的康涅狄格的样子,
$this->db_conn = new PDO("mysql:host=" . $this->host . ";dbname=" . $this->db_name, $this->username, $this->password);,这就是我想做的,,但是它说这是不正确的
$this->db_conn = new PDO("mysql:host=" . $this->host . ";dbname=" . $this->db_name, $this->username, $this->password.";charset=utf8");提供此错误数据库连接错误:
我正在使用MySql
发布于 2018-09-17 17:27:47
在用户和密码之前移动字符集。
$this->db_conn = new PDO("mysql:host=" .
$this->host .
";dbname=" . $this->db_name .
";charset=utf8" ,
$this->username,
$this->password);发布于 2018-09-17 17:26:32
这需要成为第一个论点的一部分。您的第二个版本应该如下所示:
$this->db_conn = new PDO("mysql:host=" . $this->host . ";dbname=" . $this->db_name.";charset=utf8", $this->username, $this->password);您所得到的错误是因为您的密码是错误的(您正在将";charset=utf8“附加到密码中,并且您的密码可能不会就此结束)。
https://stackoverflow.com/questions/52372559
复制相似问题