时间:2021-07-01 10:21:17 帮助过:3人阅读
//routs.phpRoute::get('/about',function(){$first = 'hello';return view('about')->with('a',$first);});
接收变量
//about.blade.php{{ $a }}
方法2,
//routs.phpRoute::get('/about',function(){$data = array('a' => 'O','b' => 'K');return view('about',$data);});
接收变量
{{ $a }}{{ $b }}
方法3,
//routs.phpRoute::get('/about',function(){$first = 'hello';$last = 'world';//参数名称要对应return view('about',compact('first','last'));});
接收变量
//about.blade.php{{ $first }}{{ $last }}