php - Laravel session/storage is empty on refresh -



php - Laravel session/storage is empty on refresh -

i have next code:

echo 'first try: <br />'; $input = session::get('input'); pre($input, false); echo 'second try: <br />'; session::put('input', 'test'); pre(session::get('input'));

which gives next output first time it's loaded :

first try: sec try: test

that expected on first time, when reload page, exact same output. info lost after refresh.

i know it's not flash data, can't find out why it's not storing data. i'm using file based sessions , xampp on windows (the same happens when using artisan serve).

the storage folder writable.

edit: tried database sessions, same result. , i'm doing straight in routes file, theres no other code can mess up.

the pre function:

function pre( $data , $kill = true) { echo '<pre>'.print_r($data,true).'</pre>'; if($kill){ exit; }

laravel's session info written part of response shutdown process. efficiency reasons - if you're making dozens of session::put calls in request, it's improve create them @ 1 time in bulk.

as result, if don't cause response view::make or response::json or have , instead exit or die, session info won't written you've short circuited response lifecycle.

php laravel

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -