laravel 之 cookie 使用
<?php namespace App\Http\Controllers\Admin; use Illuminate\Http\Request; use Illuminate\Http\Response; use App\Http\Controllers\Controller; class IndexController extends CommonController { public function setCookie(Request $request){ $minutes = 1; $response = new Response('Hello World'); $response->withCookie(cookie('name', 'virat', $minutes)); return $response; } public function getCookie(Request $request){ $value = $request->cookie('name'); echo $value; } }