General error: 1267 Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb3_general_ci,COERCIBLE) for operation '=' in /test.php
PHP 7 升级到 php8.1编码问题
mysql Ver 8.0.31,
$this->pdo = new PDO('mysql:host=' . $host . ';port=' . $port . ';dbname=' . $database . ';charset=utf8', $username, $password);
修改成
$this->pdo = new PDO('mysql:host=' . $host . ';port=' . $port . ';dbname=' . $database . ';charset=utf8mb4', $username, $password);
问题解决。
✋热门推荐