1. 程式人生 > >laravel 之 cookie 使用

laravel 之 cookie 使用

UNC etc pre brush cookie clas xtend ret bsp

<?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;
   }
}

laravel 之 cookie 使用