Cookie::__construct PHP Method

__construct() public method

Constructor for the Cookie class intialises all class variables with the given parameters. Most of the parameters map to PHP's setcookie function. It creates a new Session object via the $this->__init()
public __construct ( string $index, integer $timeout, string $path = '/', string $domain = null, boolean $httpOnly = true )
$index string The prefix to used to namespace all Symphony cookies
$timeout integer The Time to Live for a cookie, by default this is zero, meaning the cookie never expires
$path string The path the cookie is valid for on the domain
$domain string The domain this cookie is valid for
$httpOnly boolean Whether this cookie can be read by Javascript. By default the cookie cannot be read by Javascript
    public function __construct($index, $timeout = 0, $path = '/', $domain = null, $httpOnly = true)
    {
        $this->_index = $index;
        $this->_timeout = $timeout;
        $this->_path = $path;
        $this->_domain = $domain;
        $this->_httpOnly = $httpOnly;
        if (defined('__SECURE__')) {
            $this->_secure = __SECURE__;
        }
        $this->_session = $this->__init();
    }

Usage Example

Example #1
0
 function __construct($path = NULL)
 {
     parent::__construct($path);
 }
All Usage Examples Of Cookie::__construct