本文整理匯總了PHP中Cookie::toString方法的典型用法代碼示例。如果您正苦於以下問題:PHP Cookie::toString方法的具體用法?PHP Cookie::toString怎麽用?PHP Cookie::toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Cookie
的用法示例。
在下文中一共展示了Cookie::toString方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getRequestVar
if ($java == -1) {
$javascript = 0;
$java = 0;
} else {
$javascript = 1;
}
$refererUrl = getRequestVar('ref', '');
$typeTag = getRequestVar('type', "", 'string');
$site = new Site($idSite);
// debug cookie
if (PRINT_ALL_COOKIES_CONTENT) {
require_once INCLUDE_PATH . "/core/include/DataModel.class.php";
$sitesId = $site->getSitesId();
foreach ($sitesId as $sid) {
$c = new Cookie(COOKIE_PMVLOG_NAME . $sid);
print $c->toString();
}
exit;
} else {
if (PRINT_COOKIE_CONTENT) {
print $GLOBALS['cookie']->toString();
exit;
}
}
/*
* site urls
*/
// commented in 2.3b3 because its actually not used
//if(!$siteUrls = $GLOBALS['cookie']->getVar('site_urls'))
//{
// $siteUrlsBefore = $site->getUrls();
示例2: testConstructorFull
public function testConstructorFull()
{
$cookie = new Cookie('foo', 'bar', new \DateTime('2015-04-26'), '/', 'foo.com', true, true);
$this->assertEquals('foo=bar; Expires=Sun, 26 Apr 2015 00:00:00 GMT; Path=/; Domain=foo.com; Secure; HttpOnly', $cookie->toString());
}
示例3: setCookie
/**
* Sets a Cookie.
*
* <code>
* $response->setCookie(new Cookie("Foo", "Bar"));
* </code>
*
* @param Cookie Cookie
* @see Cookie
*/
public function setCookie(Cookie $cookie)
{
$this->setHeader('Set-Cookie', $cookie->toString());
}