Welcome Guest, Not a member yet? Register   Sign In
Can't get data from sessions CI4
#1

(This post was last modified: 01-08-2023, 11:07 AM by krotovroman.)

I use this config in .env:
app.sessionDriver = 'CodeIgniter\Session\Handlers\DatabaseHandler'
app.sessionSavePath = 'ci_sessions'

I record data in session this code:
Code:
$ses = [];
$ses['chat_id'] = $message['message']['chat']['id'];
$ses['command'] = $message;
  $this->session->set('ses', $ses)



 I try get data in next load page:
Code:
$old = $this->session->get();
log_message('error', print_r('old session',TRUE));
log_message('error', print_r($old,TRUE));



But arras is empty!
How do I get data from the session on the next page load?
Reply
#2

No error message?
Did you setup the table for session correctly?

Your code seems no problem. It should work.
Reply
#3

no error
table is correctly

after every request session id is new! may be is reason this problem.
I do not know how fix it(
Reply
#4

It seems your session config is not correct.
Check your session config.

Did you change any item except sessionDriver and sessionSavePath?
What if you use the default FileHandler?
What if you use the all session default config?

You can also see the HTTP requests by your browser's development tool.
Check the request/response headers and the cookie data.
Reply
#5

(01-09-2023, 03:19 AM)krotovroman Wrote: no error
table is correctly

after every request session id is new! may be is reason this problem.
I do not know how fix it(

new sess id every time?

have you session();  in initcontroller?  session();  se
Reply




Theme © iAndrew 2016 - Forum software by © MyBB