setCookie() публичный Метод

Sends a cookie.
public setCookie ( $name, $value, $expire, $path = NULL, $domain = NULL, $secure = NULL, $httpOnly = NULL ) : void
Результат void
Пример #1
0
 /**
  * Sends the session cookies.
  * @return void
  */
 private function sendCookie()
 {
     if (!headers_sent() && ob_get_level() && ob_get_length()) {
         trigger_error('Possible problem: you are starting session while already having some data in output buffer. This may not work if the outputted data grows. Try starting the session earlier.', E_USER_NOTICE);
     }
     $cookie = $this->getCookieParameters();
     $this->response->setCookie(session_name(), session_id(), $cookie['lifetime'] ? $cookie['lifetime'] + time() : 0, $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httponly'])->setCookie('nette-browser', $_SESSION['__NF']['B'], Response::BROWSER, $cookie['path'], $cookie['domain']);
 }
Пример #2
0
 /**
  * Gets the cookie
  *
  * @param string $cookieValue
  */
 protected function createCookie($cookieValue)
 {
     $currentDate = new \DateTime('+1 month');
     // Create cookie object
     $cookie = new Cookie(self::COOKIE_KEY, $cookieValue, $currentDate->format('Y-m-d'));
     // Store cookie in response
     $this->httpResponse->setCookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
 }
Пример #3
0
	/**
	 * Sends the session cookies.
	 * @return void
	 */
	private function sendCookie()
	{
		$cookie = $this->getCookieParams();
		$this->response->setCookie(
			session_name(), session_id(),
			$cookie['lifetime'] ? $cookie['lifetime'] + time() : 0,
			$cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httponly']

		)->setCookie(
			'nette-browser', $_SESSION['__NF']['B'],
			Response::BROWSER, $cookie['path'], $cookie['domain']
		);
	}
Пример #4
0
 /**
  * Sends the session cookies.
  * @return void
  */
 private function sendCookie()
 {
     $cookie = $this->getCookieParameters();
     $this->response->setCookie(session_name(), session_id(), $cookie['lifetime'] ? $cookie['lifetime'] + time() : 0, $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httponly']);
 }