Let's start with the basics, can you show me how you are trying to create a session?
For example, are you using:
Session::put($key, $value);
?
@ayyobro, hi. Yes, I'm using default behaivor, here is my code:
Session::put([
'user_id' => $user->user_id,
'user_level' => $user->user_level,
'user_name' => $user->user_name,
'customer_id' => $customer->customer_id,
'city_id' => $customer->city_id,
'customer_name' => $customer->customer_name,
'customer_distributor' => $customer->customer_distributor,
'number_id' => $number->number_id,
'number' => $number->number,
]);
Try it this way:
Session::put('test', array('key' => 'test1','key1' => 'test2','key2' => 'test3'));
I don't think session handles all the arguments you give. If that doesn't work, you could try looping through the data to store each item
hm, here is source of Laravel
/**
* Put a key / value pair or array of key / value pairs in the session.
*
* @param string|array $key
* @param mixed|null $value
* @return void
*/
public function put($key, $value = null)
{
if ( ! is_array($key)) $key = array($key => $value);
foreach ($key as $arrayKey => $arrayValue)
{
$this->set($arrayKey, $arrayValue);
}
}
It seems my memory failed me looking at the source...
In this case it may be wise to store the data in an array variable first then try foreach:
foreach($myArray as $key => $val)
{
Session::put($key, $val);
}
Hi @paveleremin
I'm having the same problem here. Did you find a solution why it does not save? It works perfectly fine with "file" session drivers, but with memcached nothing is saved on Session::put.
thanks
@SimonErich, no I also try ask at github: https://github.com/laravel/framework/issues/6272
You forgot to do "Session::save();" after "Session::put('key', $variable);" Please try again and close the issue (https://github.com/laravel/framework/issues/6272) if your problem was solved!
paveleremin said:
I done:
- sudo apt-get install memcached
- sudo apt-get install php5-memcached
- sudo service apache2 restart
in my phpinfo() i saw Memcacmed so all is ok Cache::put('abcd',123) and Cache::get('abcd') - work fine but sessions not work.
Maybe some one can help me?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.