Closed sshymko closed 6 years ago
Yes, you must implement it by yourself.
PHP session depends on $_COOKIE
and use the files to save the session context.
You can create a session table in the database, use $response->setcookie
to give the client a random token, save the token in the database, through $request->cookies
attribute to get client session-token and find it in the database.
You can see the repo https://github.com/swoft-cloud/swoft-session, Or just use swoft framework.
You could use https://github.com/swoft-cloud/swoft directly, or see https://github.com/swoft-cloud/swoft-session for reference
@twose and @huangzhhui, Thanks for the quick response! Closing.
PHP process is designed to handle a single request with a single session context. In case of Swoole, single process will be handling multiple requests, each requiring its own session context.
Is Swoole completely incompatible with PHP sessions? Functions
session_*
cannot be used, correct?How to implement sessions with Swoole?