Illuminate\Session\Store.php

(Framework/src/Illuminate/Session/Store.php에서 넘어옴)

1 개요[ | ]

framework/src/Illuminate/Session/Store.php
Illuminate\Session\Store.php
PHP
Copy
namespace Illuminate\Session;

use Closure;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use SessionHandlerInterface;
use Illuminate\Contracts\Session\Session;

class Store implements Session
{
    protected $id;
    protected $name;
    protected $attributes = [];
    protected $handler;
    protected $started = false;

    public function __construct($name, SessionHandlerInterface $handler, $id = null)
    {
        $this->setId($id);
        $this->name = $name;
        $this->handler = $handler;
    }

    public function start()
    {
        $this->loadSession();
        if (! $this->has('_token')) {
            $this->regenerateToken();
        }
        return $this->started = true;
    }

    protected function loadSession()
    {
        $this->attributes = array_merge($this->attributes, $this->readFromHandler());
    }

... (생략)
    protected function generateSessionId()
    {
        return Str::random(40);
    }

    public function setExists($value)
    {
        if ($this->handler instanceof ExistenceAwareInterface) {
            $this->handler->setExists($value);
        }
    }

    public function token()
    {
        return $this->get('_token');
    }

    public function regenerateToken()
    {
        $this->put('_token', Str::random(40));
    }
... (생략)
}

2 같이 보기[ | ]

3 참고[ | ]

  • Laravel
    한국에서 개발되어 나오고 있는 Xpress Engine이나 계시판 중심으로 돌려지고 있는 CMS 과 비교하는 것은 사과와 오렌지를 비교하는 것 같지만 조금은 느리다고 느낄 수 있겠네요. 美村䎛