C/C++教程

laravel COOKIE获取和设置

本文主要是介绍laravel COOKIE获取和设置,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

laravel COOKIE 获取

use Illuminate\Http\Request;

use Illuminate\Support\Facades\Cookie;

class TaskController extends Controller
{
    //
    public function index(){
       return "index";
    }

    public function cookiess(){
      //return request()->cookie('laravel_session');
      return Cookie::get('laravel_session');
      //return 11;
    }
}

laravel COOKIE 设置

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use Illuminate\Support\Facades\Cookie;

class TaskController extends Controller
{
    //
    public function index(){
       return "index";
    }

    public function cookiess(){
      //return request()->cookie('laravel_session');
      //return Cookie::get('laravel_session');
      //return 11;

      //return response('dada')->cookie('age',10,5);

     Cookie::queue('nae',10,19);
    }
}

文章来自 www.sxlenovo.com
这篇关于laravel COOKIE获取和设置的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!