Reputation: 143
I have set Yii application session to save in database.
In one part of my app i need to read created session by Yii but
i can't use Yii::app()->session
because my code is out of Yii application.
Can i read this session with PHP function?
or
create and save this specific session with Yii in temp folder instead of database(so i can easily use $_SESSION
)?
Upvotes: 0
Views: 454
Reputation: 61138
You could catch the cookie sent by browser and select from table using session id from cookie, but most probably there is a better way to solve your problem.
Why can't you simply move the code into Yii controller? Even if it is something specific, it's usually easy to work around.
Upvotes: 1
Reputation: 168685
The function you're looking for is session_set_save_handler()
.
This function allows you to override the default handling of the $_SESSION
variable. You can use it to specify a set of functions that will handle the loading, saving, and other tasks associated with session handling.
You can use these functions to load session data from a database, or any other source you may want.
Hope that helps.
Upvotes: 1