Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 会话在laravel 4上没有值_Php_Session_Laravel_Laravel 4_Flash Message - Fatal编程技术网

Php 会话在laravel 4上没有值

Php 会话在laravel 4上没有值,php,session,laravel,laravel-4,flash-message,Php,Session,Laravel,Laravel 4,Flash Message,我想知道为什么当我 Session::flash('status', 'success'); 当我试图回应它的价值时 $status = Session::get('status'); dd($status); 我得到一个空值 我的控制器: Session::flash('status','success'); Session::flash('message', Lang::get('alerts.messages.successUpdate')); Session::flash('type

我想知道为什么当我

Session::flash('status', 'success');
当我试图回应它的价值时

$status = Session::get('status');
dd($status);
我得到一个空值

我的控制器:

Session::flash('status','success');
Session::flash('message', Lang::get('alerts.messages.successUpdate'));
Session::flash('type', Lang::get('alerts.transactions.po'));

return Redirect::action('SuppliersController@show',$supplierId);
我的宏:

<?php
HTML::macro('flash', function()
{
$message    = Session::get('message');
$status     = Session::get('status');
$type       = Session::get('type');
return ($message) ? '<div class="alert alert-'.$status.'"><a class="close" data-dismiss="alert" href="#" aria-hidden="true">&times;</a><p>'.$message.' '.$type.'</p></div>':''; });
  ?>

您正在尝试读取同一请求上的会话还是下一个请求上的会话?您确定在
$message\u status=session::get('key')之前没有读取会话的代码行吗是否从“闪存”中删除?这只是一个想法。这会很奇怪,但是如果您将
status
重命名为
status\u name
或其他名称,您能测试会发生什么吗?:)同样的情况也会发生吗?好的,在
$message=Session::get('message')之前,您可以执行
打印(Session::all())
SuppliersController@show
方法。您将执行一个操作,而不是返回一个视图,因此该方法在这里是相关的。
<?php echo HTML::flash(); ?>