Questions about MYSQL utf8mb4 string set.
The table structure is as follows:
The following code:
$db = new mysqli('x', 'xxx', 'xxxxx'); $db->select_db('xxx'); $db->set_charset('utf8mb4'); //这里是一个emoji表情 $contents = <<<EOT "\ud83d\udca5" EOT; $contents = json_decode($contents). "hello"; echo $contents, "\t\n"; $sql = "INSERT INTO `utf8mb4`(`contents`) VALUES('$contents')"; echo $sql, "\t","\n"; $db->query($sql); print_r($db->error_list); echo "\t\n"; exit();
But after storage, it is a ?
as shown below:
Looking for a solution.