laravel - How long does the message returned by redirect()->with('message','') last in the session?
PHP中文网
PHP中文网 2017-05-16 16:55:34
0
1
708

Code in the controller:
return redirect('reviewmessage')->with('message', array('type' => 'success','content'=>'Message successful! You can view other people's or your previous messages. '));
Route 'reviewmessage' returns the view 'reviewmessage',
I add it to the view
@if (Session::has('message') )

        <p class="alert alert-success" >
            <p>{{ Session::get('message')['content'] }}</p>
        </p>

@endif
After the operation is successful, the content in the message will be returned.
My question is how long will this session['message'] be saved?
After I refresh the page, this prompt will disappear, that is, it will only survive the current request?
How to make it exist for a long time?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
迷茫

通常重定向至新的 URL 时会一并将数据存进一次性 Session相当于Session::flash('message', 'value');
想长期存在Session::put('message', 'value');

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template