1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| return response('Hello World', 200) ->header('Content-Type', 'text/plain') ->withHeaders([ // 一次设置多个header头 'Content-Type' => $type, 'X-Header-One' => 'Header Value', 'X-Header-Two' => 'Header Value', ]) ->cookie('name', 'value', $minutes) ->cookie($name, $value, $minutes, $path, $domain, $secure, $httpOnly);
return redirect('home/dashboard'); return redirect()->route('login'); return redirect()->route('profile', ['id' => 1]); return redirect()->route('profile', [$user]); return redirect()->action('HomeController@index'); return redirect()->action('UserController@profile', ['id' => 1]); return redirect()->away('https://www.google.com'); return redirect('dashboard')->with('status', 'Profile updated!');
return back()->withInput();
return response()->json([ 'name' => 'Abigail', 'state' => 'CA', ]);
return response() ->json(['name' => 'Abigail', 'state' => 'CA']) ->withCallback($request->input('callback'));
return response()->download($pathToFile); return response()->download($pathToFile, $name, $headers); return response()->download($pathToFile)->deleteFileAfterSend(true); return response()->file($pathToFile); return response()->file($pathToFile, $headers);
return response()->streamDownload(function () { echo GitHub::api('repo') ->contents() ->readme('laravel', 'laravel')['contents']; }, 'laravel-readme.md');
|