Laravel:升级到5.3后无法获得Cookie值

时间:2017-01-14 09:46:17

标签: php laravel cookies laravel-5.3

我在Laravel 5.1应用程序中成功使用了cookie;然而,在升级到5.3之后,我注意到虽然我仍然可以设置cookie(可以在浏览器中看到它们),但我无法再获取/检索它们。

这是控制器中的相关代码; $ condn变量最终为空。任何帮助将不胜感激!

this.myForm.controls['isFitted'].valueChanges.subscribe(
  value => {
    this.proposal.is_fitted = value;
    let qp = this.proposal.quoted_products[this.qpCurrentIndex];
      qp.rooms.forEach(function(room) {
        room.is_fitted = value;
    });
  }
); 

1 个答案:

答案 0 :(得分:1)

我已经意识到这是因为在app / http / Kernel中,我有以下代码;我删除了除维护一行以外的所有行(为了匹配Laravel' s git中的相同内核文件 - https://github.com/laravel/laravel/blob/master/app/Http/Kernel.php)然后它起作用了

protected $middleware = [
        \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
        \App\Http\Middleware\EncryptCookies::class,
        \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
        \Illuminate\Session\Middleware\StartSession::class,
        \Illuminate\View\Middleware\ShareErrorsFromSession::class,
        \App\Http\Middleware\VerifyCsrfToken::class,
    ];