Cookie.php 1.31 KB
Newer Older
Qiang Xue committed
1 2
<?php
/**
Qiang Xue committed
3
 * Cookie class file.
Qiang Xue committed
4 5
 *
 * @link http://www.yiiframework.com/
Qiang Xue committed
6
 * @copyright Copyright &copy; 2008 Yii Software LLC
Qiang Xue committed
7 8 9
 * @license http://www.yiiframework.com/license/
 */

Qiang Xue committed
10 11
namespace yii\web;

Qiang Xue committed
12
/**
Qiang Xue committed
13
 * Cookie represents information related with a cookie, such as [[name]], [[value]], [[domain]], etc.
Qiang Xue committed
14 15
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
Qiang Xue committed
16
 * @since 2.0
Qiang Xue committed
17
 */
Qiang Xue committed
18
class Cookie extends \yii\base\Object
Qiang Xue committed
19 20 21 22 23 24 25 26
{
	/**
	 * @var string name of the cookie
	 */
	public $name;
	/**
	 * @var string value of the cookie
	 */
Qiang Xue committed
27
	public $value = '';
Qiang Xue committed
28 29 30
	/**
	 * @var string domain of the cookie
	 */
Qiang Xue committed
31
	public $domain = '';
Qiang Xue committed
32
	/**
Qiang Xue committed
33 34
	 * @var integer the timestamp at which the cookie expires. This is the server timestamp.
	 * Defaults to 0, meaning "until the browser is closed".
Qiang Xue committed
35
	 */
Qiang Xue committed
36
	public $expire = 0;
Qiang Xue committed
37 38 39
	/**
	 * @var string the path on the server in which the cookie will be available on. The default is '/'.
	 */
Qiang Xue committed
40
	public $path = '/';
Qiang Xue committed
41 42 43
	/**
	 * @var boolean whether cookie should be sent via secure connection
	 */
Qiang Xue committed
44
	public $secure = false;
Qiang Xue committed
45 46 47
	/**
	 * @var boolean whether the cookie should be accessible only through the HTTP protocol.
	 * By setting this property to true, the cookie will not be accessible by scripting languages,
Qiang Xue committed
48
	 * such as JavaScript, which can effectively help to reduce identity theft through XSS attacks.
Qiang Xue committed
49
	 */
Qiang Xue committed
50
	public $httpOnly = false;
Qiang Xue committed
51
}