We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

how to regenerate different session id??

Hi all! i have a problem with session....i use Redis to store session's user... ex: i have two user: user1, user2. for user1 have session_id(value)=a80mr3r18n73h47mlnnviqhbu2 and (key) mykey_a80mr3r18n73h47mlnnviqhbu2 is stored redis.

i want to regenerate session id for each user and the sessions, keys are different.

ex: user2: session_id(value)=nm4mr901nn73h47ouinviqhb49 and (key) mykey_nm4mr901nn73h47ouinviqhb49

so, how can i do it??? or have a function??? thank so much!

public regenerateId ([unknown $deleteOldSession])



thank you! but regenerateId() function will delete old session

public regenerateId ([unknown $deleteOldSession])


@phamdien: you can supply first argument as false, since default is true (deleteOldSession)

From Zephir codebase:

    public function regenerateId(bool deleteOldSession = true) -> <Adapter>
        return this;