Храним Emoji смайлики в mysql используя Yii2

Вначале в конфигурации подключения к БД меняем кодировку подключения на utf8mb4

'components' => [
        'db' => [
            'class' => 'yii\db\Connection',
            'charset' => 'utf8mb4',
        ],
    ],

Далее заменяем кодировку таблиц базы данных с utf8_general_ci на utf8mb4_general_ci. Вставляем смайлики и радуемся что они корректно сохраняются в таблицах.

comments powered by HyperComments
Дмитрий Духнич
2016-10-10 10:28:49
Спасибо!
Саша
2016-10-27 02:31:59
Где найти конфигурации подключения к БД?
Алексей
2017-03-20 15:24:33
в /common/config/main-local.php
Сергей
2017-04-28 18:45:28
помогло. спасибо
my99laju
2026-07-19 20:57:34
Really impressed with the variety of options here. It feels very secure and the payouts are handled professionally. Give <a href='https://my99laju.my' rel="nofollow ugc">my99laju</a> a go if you are looking for a reliable spot.
bdwow777
2026-07-19 20:57:51
The excitement here is on another level! I love how the bonuses are actually achievable and not just bait. Great job to the team at <a href='https://bdwow777.com' rel="nofollow ugc">bdwow777</a>.
bet393login
2026-07-19 20:58:16
Was looking for a stable login link and this is exactly what I needed. No redirects or annoying pop-ups, just straight to the action at <a href='https://bet393login.com' rel="nofollow ugc">bet393login</a>.
При копировании материалов обратная ссылка на play-stop.ru желательна обязательна!