How to display Emoji on my Web Broswer using PHP

ぐ巨炮叔叔 提交于 2019-12-01 14:50:39

You need to configure your database connection like the following:

    $db = new mysqli('localhost', 'username', 'password', 'db_name');

    if ($db->connect_error) {
        die("Connection failed: " . $db->connect_error);
    }

    $db->query("SET character_set_client='utf8mb4'");

    $db->query("SET character_set_results='utf8mb4'");

    $db->query("set collation_connection='utf8mb4_bin'");

And ensure your HTML file is UTF-8, have the following in between the head tags:

    <meta charset="utf-8">

Hope it helps. Cheers!

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!