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


PHP Cookie::domain方法代码示例

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


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

示例1: init

 /**
  * Application initialization
  *     - Loads the plugins
  *     - Sets the cookie configuration
  */
 public static function init()
 {
     // Set defaule cache configuration
     Cache::$default = Kohana::$config->load('site')->get('default_cache');
     try {
         $cache = Cache::instance()->get('dummy' . rand(0, 99));
     } catch (Exception $e) {
         // Use the dummy driver
         Cache::$default = 'dummy';
     }
     // Load the plugins
     Swiftriver_Plugins::load();
     // Add the current default theme to the list of modules
     $theme = Swiftriver::get_setting('site_theme');
     if (isset($theme) and $theme != "default") {
         Kohana::modules(array_merge(array('themes/' . $theme->value => THEMEPATH . $theme->value), Kohana::modules()));
     }
     // Clean up
     unset($active_plugins, $theme);
     // Load the cookie configuration
     $cookie_config = Kohana::$config->load('cookie');
     Cookie::$httponly = TRUE;
     Cookie::$salt = $cookie_config->get('salt', Swiftriver::DEFAULT_COOKIE_SALT);
     Cookie::$domain = $cookie_config->get('domain') or '';
     Cookie::$secure = $cookie_config->get('secure') or FALSE;
     Cookie::$expiration = $cookie_config->get('expiration') or 0;
     // Set the default site locale
     I18n::$lang = Swiftriver::get_setting('site_locale');
 }
开发者ID:aliyubash23,项目名称:SwiftRiver,代码行数:34,代码来源:Swiftriver.php

示例2: set

 public static function set($name, $value, $lifetime = null, $domain = null)
 {
     if ($lifetime === null) {
         $lifetime = Cookie::$expiration;
     }
     if ($lifetime !== 0) {
         $lifetime += time();
     }
     if ($domain !== null) {
         Cookie::$domain = $domain;
     }
     $value = Cookie::salt($name, $value) . '~' . $value;
     return setcookie($name, $value, $lifetime, Cookie::$path, Cookie::$domain, Cookie::$secure, Cookie::$httponly);
 }
开发者ID:noikiy,项目名称:kohana,代码行数:14,代码来源:Cookie.php

示例3: init

 /**
  * @param array $opts Array of options. Supported keys:<ul>
  *              <li>'path' - The path on the server in which the cookie will be available on.
  *                         If set to '/', the cookie will be available within the entire domain.
  *                         If set to '/foo/', the cookie will only be available within the /foo/ directory and all sub-directories such as /foo/bar/ of domain.
  *                         Default value is: /<br>
  *              <li>'domain' - The domain that the cookie is available to.
  *                           Setting the domain to 'www.example.com' will make the cookie available in the www subdomain and higher subdomains.
  *                           Cookies available to a lower domain, such as 'example.com' will be available to higher subdomains, such as 'www.example.com'.
  *                           Older browsers still implementing the deprecated » RFC 2109 may require a leading . to match all subdomains.
  *                           Default value is '.' + $_SERVER['SERVER_NAME'] [www is omitted]<br>
  *              <li>'prefix' - Prefix for cookies. See: self::$prefix
  */
 public static function init(array $opts = array())
 {
     if (self::$inited) {
         return;
     }
     if (isset($opts['path']) and (string) $opts['path']) {
         self::$path = (string) $opts['path'];
     }
     if (isset($opts['prefix'])) {
         self::$prefix = (string) $opts['prefix'];
     }
     if (isset($opts['domain']) and (string) $opts['domain']) {
         self::$domain = (string) $opts['domain'];
     } else {
         self::$domain = $_SERVER['SERVER_NAME'];
         self::$domain = '.' . preg_replace('#^www\\.#', '', strtolower(self::$domain));
     }
     self::$secure = (isset($_SERVER['HTTPS']) and strtolower($_SERVER['HTTPS']) == 'on');
 }
开发者ID:xiaoweidotnet,项目名称:Cookie,代码行数:32,代码来源:Cookie.php

示例4: array

Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Config_File());
/**
 * Enable modules. Modules are referenced by a relative or absolute path.
 */
Kohana::modules(array('cache' => MODPATH . 'cache', 'database' => MODPATH . 'database', 'image' => MODPATH . 'image', 'orm' => MODPATH . 'orm', 'paypal' => MODPATH . 'paypal', 'kandler' => MODPATH . 'kandler', 'email' => MODPATH . 'email', 'pagination' => MODPATH . 'pagination', 'sitemap' => MODPATH . 'sitemap', 'amazon' => MODPATH . 'amazon'));
/**
 * Cache
 */
Kohana::$caching = TRUE;
Cache::$default = 'apc';
/**
 * Set the routes. Each route must have a minimum of a name, a URI and a set of
 * defaults for the URI.
 */
// Default route
Route::set('default', '(<controller>(/<action>(/<id>)))')->defaults(array('controller' => 'ads', 'action' => 'home'));
// Error route
Route::set('error', 'error/<action>(/<message>)', array('action' => '[0-9]++', 'message' => '.+'))->defaults(array('controller' => 'error_handler'));
/**
 * Cookie configuration settings
 */
Cookie::$salt = 'ASJ12094X:F?!*!*AD';
Cookie::$expiration = Date::MONTH;
Cookie::$httponly = TRUE;
Cookie::$secure = isset($_SERVER["HTTPS"]);
Cookie::$domain = '.gowork.at';
开发者ID:hbarroso,项目名称:Goworkat,代码行数:30,代码来源:bootstrap.php

示例5: array

# copy config/init.php.default to config/init.php
Kohana::init(include APPPATH . 'config/init.php');
/**
 * Attach the file write to logging. Multiple writers are supported.
 */
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Config_File());
/**
 * Cookie config.
 */
$cookie = Kohana::$config->load('cookie');
Cookie::$salt = $cookie->salt;
Cookie::$expiration = $cookie->expiration;
Cookie::$domain = $cookie->domain;
Cookie::$path = $cookie->path;
Cookie::$secure = $cookie->secure;
Cookie::$httponly = $cookie->httponly;
/**
 * Enable modules. Modules are referenced by a relative or absolute path.
 */
Kohana::modules(array());
/**
 * Set the routes. Each route must have a minimum of a name, a URI and a set of
 * defaults for the URI.
 */
Route::set('api', '<directory>(/<controller>(/<action>(/<params>)))', array('params' => '.*', 'directory' => '(v1|v2)'))->defaults(array('controller' => 'defaults', 'action' => 'index', 'directory' => 'v1'));
Route::set('join', 'join')->defaults(array('controller' => 'auth', 'action' => 'join'));
Route::set('default', '(<controller>(/<action>(/<id>)))')->defaults(array('controller' => 'welcome', 'action' => 'index'));
开发者ID:rhrn,项目名称:apirn,代码行数:31,代码来源:bootstrap.php

示例6: setCookieDomain

 public static function setCookieDomain($domain)
 {
     if (preg_match('/^([\\da-z\\.-]{0,61})?(\\.[\\da-z-]{0,61}\\.[a-z]{2,6})$|^([\\da-z-]{0,61}\\.[a-z]{2,6})$/', $domain, $matches)) {
         if (count($matches) == 3) {
             Cookie::$domain = $matches[2];
         } else {
             if (isset($matches[3])) {
                 Cookie::$domain = "." . $matches[3];
             }
         }
     }
 }
开发者ID:kizz66,项目名称:meat,代码行数:12,代码来源:Router.php

示例7: array

 * Attach the file write to logging. Multiple writers are supported.
 */
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Config_File());
$hostname = $_SERVER['SERVER_NAME'];
if (strpos($hostname, 'earlybirds.qyuki.com') !== FALSE) {
    Cookie::$domain = 'earlybirds.qyuki.com';
}
if (strpos($hostname, 'eb.qyuki.com') !== FALSE) {
    Cookie::$domain = 'eb.qyuki.com';
}
if (strpos($hostname, '8eta.qyuki.com') !== FALSE) {
    Cookie::$domain = '8eta.qyuki.com';
}
Cookie::$salt = 'fdsh-tretgd-re-gfds-gt-erg-fdg-';
/**
 * Enable modules. Modules are referenced by a relative or absolute path.
 */
Kohana::modules(array('auth' => MODPATH . 'auth', 'database' => MODPATH . 'database', 'image' => MODPATH . 'image', 'orm' => MODPATH . 'orm', 'formo' => MODPATH . 'formo', 'userguide' => MODPATH . 'userguide'));
/**
 * Set the routes. Each route must have a minimum of a name, a URI and a set of
 * defaults for the URI.
 */
Route::set('sections', '<directory>(/<controller>(/<action>(/<id>(/<param>))))', array('directory' => "(admin|jobs)"))->defaults(array('directory' => 'admin', 'controller' => 'user', 'action' => 'index'));
Route::set('default', '(<controller>(/<action>(/<id>(/<param1>(/<param2>(/<param3>))))))')->defaults(array('controller' => 'stimulus', 'action' => 'index'));
define('SIGNED_IN_HOME', '/stimulus');
define('NON_SIGNED_IN_HOME', '/user');
/**
开发者ID:kanikaN,项目名称:qload,代码行数:31,代码来源:bootstrap.php

示例8: array

$config = Kohana::$config->load('base');
Kohana::$base_url = $config->get('base_url', '/');
/**
 * Enable modules. Modules are referenced by a relative or absolute path.
 */
Kohana::modules(Kohana::$config->load('modules')->as_array());
/**
 * Set the system default language
 * Muti-language settings in config/multilang.php
 */
I18n::lang('en-us');
/**
 * set Cookie config
 */
Cookie::$salt = $config->get('salt', 'hustoj');
Cookie::$domain = $config->get('domain');
/**
 * Set the routes. Each route must have a minimum of a name, a URI and a set of
 * defaults for the URI.
 */
Route::set('show_problem_data', 'admin/problem/showdata/<id>/<filename>.<ext>', array('filename' => '\\w+', 'ext' => '\\w+'))->defaults(array('directory' => 'admin', 'controller' => 'problem', 'action' => 'showdata'));
Route::set('del_problem_data', 'admin/problem/deldata/<id>/<filename>.<ext>', array('filename' => '\\w+', 'ext' => '\\w+'))->defaults(array('directory' => 'admin', 'controller' => 'problem', 'action' => 'deldata'));
Route::set('admin', 'admin(/<controller>(/<action>(/<id>)))')->defaults(array('directory' => 'admin', 'controller' => 'index', 'action' => 'index'));
Route::set('auth', '<action>', array('action' => '(login|logout|setting|setting)'))->defaults(array('controller' => 'user'));
Route::set('search', 'problem/search')->defaults(array('controller' => 'problem', 'action' => 'search'));
Route::set('ranklist', 'rank/user(/<id>)', array('id' => '[[:word:]]+'))->defaults(array('controller' => 'user', 'action' => 'list'));
Route::set('profile', 'u/<uid>', array('uid' => '[[:word:]]+'))->defaults(array('controller' => 'user', 'action' => 'profile'));
Route::set('status', 'status')->defaults(array('controller' => 'solution', 'action' => 'status'));
Route::set('topic', 't/<id>', array('id' => '\\d+'))->defaults(array('controller' => 'discuss', 'action' => 'topic'));
Route::set('news', 'news/<id>', array('id' => '\\d+'))->defaults(array('controller' => 'index', 'action' => 'news'));
Route::set('page', '<action>', array('action' => '(faqs|about|links|contact|help|terms)'))->defaults(array('controller' => 'index'));
开发者ID:creat2012,项目名称:hustoj_official,代码行数:31,代码来源:bootstrap.php


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