Closed dcdebug closed 4 years ago
hi @dcdebug The session component has not been migrated to 2.0
. It may take a while to wait.
我使用的swoft是最新版,都是走的官方的2.x的文档, 那么我目前使用session 有没有比较好的方案? ? ? 使用原生的php session 的话,如何避免:session_start(): Cannot start session when headers already sent At /home/darrykinger/php_developer/swoft/app/Http/Controller/UserController.php line 37 的错误提示? 我的业务需求是实现用户的登录,将用户的登录信息保存到session
可以用jwt替代,也比较简单。用户的登录信息存到redis。
全局中间件检查token,匹配到信息就存储到context,这样在后面都可以用。
OK,谢谢,小型系统,暂时不考虑使用redis ,考虑使用mysql代替,用户人不多,拿swoole+swoft练练手,多谢指教
可以用jwt替代,也比较简单。用户的登录信息存到redis。
全局中间件检查token,匹配到信息就存储到context,这样在后面都可以用。
context 是什么? 不是存储在浏览器中吧?我发现使用jwt 用于api的授权比较好,但是jwt+redis ,在检测客户端的cookie的时候,很麻烦..
很期待swoft/session组件迁移到2.0x版本使用,目前jwt做管理后台很难做...
很期待swoft/session组件迁移到2.0x版本使用,目前jwt做管理后台很难做...
@nanyounanyounan session 2.0 版本的已经发布了啊
可是2.0文档上没有说明,而且我composer下来后,使用的时候报错,session组件信号量 监听不到 什么的问题,然后就放弃使用了,十分感谢您的回复@inhere
你是哪里使用不对吧!demo仓库 https://github.com/swoft-cloud/swoft 里也早就带了session组件呢。
文档也是有的 http://swoft.io/docs/2.x/zh-CN/extra/http-session.html
对不起,打扰您了,是我的不好,新文档没找到,谢谢指导@inhere
php --ri swoole
)php -v
)Describe the bug A clear and concise description of what the bug is.
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Details
how i fix this ? 2.x document can't found the session info;