简体   繁体   中英

session_start() is not success when use multi byte into the session in cakephp3

Recently I started to use cakephp3.1 and I get the error that bellow.

Warning (2): session_start(): Trying to destroy uninitialized session [CORE/src/Network/Session.php, line 324]

Warning (2): session_start() [function.session-start]: Failed to decode session object. Session has been destroyed [CORE/src/Network/Session.php, line 324]

Warning (2): session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/www/service/vendor/cakephp/cakephp/src/Error/Debugger.php:742) [CORE/src/Network/Session.php, line 324]

When I set multi byte word into the session such as login user's name is Japanese or something multi byte word set to flash, it's happen.

So I assumed I did't installed mbstring extension. However there's already installed.

This generally happens due to the session storage not being able to handle multibyte characters. If the storage is a mysql database then setting the

Character Set to utf8

Collation to utf8_general_ci

for the table and the field holding the session data solves these problems.

使用base64_encode()这对你使用多字节字符串非常有用我将它用于印地语。

将数据库编码设置为utf8_general_ci

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM