本文整理汇总了PHP中Cookie::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Cookie::init方法的具体用法?PHP Cookie::init怎么用?PHP Cookie::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cookie
的用法示例。
在下文中一共展示了Cookie::init方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* 初步过滤用户通过http提交的数据
* 并销毁全局数组 消除不安全因素
* @param Cookie $cookie cookie对象
*/
public function __construct($cookie)
{
$pattern = '/^[a-z0-1-_\\.]+$/i';
foreach (array('get', 'post', 'cookie', 'files') as $data) {
$inputData = '_' . strtoupper($data);
foreach ($GLOBALS[$inputData] as $key => $val) {
if (preg_match($pattern, $key)) {
$tmp =& $this->{$data};
$tmp[$key] = $val;
}
}
unset($GLOBALS[$inputData]);
}
$cookie->init($this->cookie);
$this->cookie = $cookie;
}
示例2: cookie
public static function cookie()
{
Lib::load('cookie');
return Cookie::init();
}
示例3: cookie
public static function cookie()
{
Lib::load('cookie');
$cookie = Cookie::init();
$totalArgs = func_num_args();
$arguments = func_get_args();
if ($totalArgs === 1) {
return $cookie->get($arguments[0]);
}
if ($totalArgs === 2) {
if ($arguments[1] === null) {
return $cookie->delete($arguments[0]);
}
return $cookie->set($arguments[0], $arguments[1]);
}
return $cookie;
}
示例4: mcrypt_encrypt
return mcrypt_encrypt(self::$cipher, self::$salt, $value . "@" . self::$user_angent, self::$mode, $iv);
}
public static function init()
{
self::$user_angent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "No User Agent";
self::$salt = $GLOBALS['config']['cookie'];
self::$expiration = 0;
self::$parts = 2;
self::$mode = MCRYPT_MODE_ECB;
self::$cipher = MCRYPT_DES;
}
/**
* 删除 Cookie
*
* @param string $key
*/
public static function delete($key)
{
$key = self::hashKey($key);
$cname = str_split($key, ceil(strlen($key) / self::$parts));
for ($i = 0; $i < self::$parts; $i++) {
setcookie($cname[$i], null, time() - 3600);
}
}
private static function hashKey($key)
{
return md5($key);
}
}
Cookie::init();