how to get session values
I save a session value like this
Session::push('image.hash.'.$imageHash, $imageHash);
later I want to check on all sessions that are image.hash.* since I don't know at later time the value of $imageHash
I tried this
if(Session::has('image.hash.*'))
but ofcourse it does not work. How can I loop through all these session values if I dont know the last part
image.hash.djn6ago
image.hash.fJtbru
image.hash.ai12de
Session::all() will give you all session data in array.
$session = Session::all();
$mySession = [];
forearch ($session as $value) {
if (strpos($value, 'image.hash') !== false) {
$mySession[] = $value;
}
}
$mySession will contain 'image.hash';
@ehtasham
I have now actually tried your example and I get this error
strpos() expects parameter 1 to be string, array given
any ideas what I can do about it?
Please or to participate in this conversation.