我正在尝试以这种方式检索变量以及消息。但是,我才知道这实际上不是一种方式。 $count
是与消息一起显示的变量。
public function now(Request $request)
{
$name=$request->get('name');
$contact=$request->get('contact');
$level=$request->get('level');
$count=$level*3.5;
return redirect('/lost')
->with ('message','You have increased your level to $count.');
}
答案 0 :(得分:1)
这将有效:
<强> PHP 强>
public function now(Request $request)
{
$name=$request->get('name');
$contact=$request->get('contact');
$level=$request->get('level');
$count=$level*3.5;
return redirect('/lost')
->with ('message','You have increased your level to ' . $count . ' .');
}
答案 1 :(得分:0)
只需更改
with ('message','You have increased your level to $count.');
到
with ('message',"You have increased your level to $count.");
(双引号而不是单引号)
您可能会看到this了解差异