当前位置: 首页>>代码示例>>PHP>>正文


PHP IResponse::setCookie方法代码示例

本文整理汇总了PHP中Nette\Http\IResponse::setCookie方法的典型用法代码示例。如果您正苦于以下问题:PHP IResponse::setCookie方法的具体用法?PHP IResponse::setCookie怎么用?PHP IResponse::setCookie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\Http\IResponse的用法示例。


在下文中一共展示了IResponse::setCookie方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendCookie

 /**
  * 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']);
 }
开发者ID:pdostal,项目名称:nette-blog,代码行数:12,代码来源:Session.php

示例2: createCookie

 /**
  * 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());
 }
开发者ID:jirinapravnik,项目名称:mobile-detect,代码行数:13,代码来源:DeviceView.php

示例3: sendCookie

	/**
	 * 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']
		);
	}
开发者ID:norbe,项目名称:nette,代码行数:17,代码来源:Session.php

示例4: sendCookie

 /**
  * 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']);
 }
开发者ID:nette,项目名称:http,代码行数:9,代码来源:Session.php


注:本文中的Nette\Http\IResponse::setCookie方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。