douxi3554 2017-09-03 06:40
浏览 143
已采纳

如何使用PHP在我的Web浏览器上显示表情符号

I'm trying tp display Emojis from my database to Web Browser. I tried to input emoji from my phone to my app and it is saved to database as 'ðŸ˜'. How can I display it to PHP as emoji like this

  • 写回答

1条回答 默认 最新

  • duanfen7676 2018-02-11 21:08
    关注

    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!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度