本文整理匯總了PHP中Phalcon\DI\FactoryDefault::getCookies方法的典型用法代碼示例。如果您正苦於以下問題:PHP FactoryDefault::getCookies方法的具體用法?PHP FactoryDefault::getCookies怎麽用?PHP FactoryDefault::getCookies使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Phalcon\DI\FactoryDefault
的用法示例。
在下文中一共展示了FactoryDefault::getCookies方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: EventsManager
$eventsManager = new EventsManager();
//$eventsManager->attach('dispatch:beforeDispatch', new SecurityPlugin);
//$eventsManager->attach('dispatch:beforeException', new NotFoundPlugin);
$dispatcher = new Dispatcher();
$dispatcher->setEventsManager($eventsManager);
return $dispatcher;
});
//Real-Time notifications checker
$di->set('notifications', function () {
return new NotificationsChecker();
}, true);
//Translation application use Gettext or Native Array
$di->set('translation', function () use($di) {
$language = $di->get('config')->language;
$code = $language->code;
if ($di->getCookies()->has('code')) {
$code = $di->getCookies()->get('code')->getValue();
}
if ($language->gettext) {
$translation = new Gettext(['locale' => $code, 'directory' => ROOT_DIR . 'core/lang', 'defaultDomain' => 'messages']);
} else {
$path = ROOT_DIR . 'core/lang/messages/' . $code . '.php';
if (!file_exists($path)) {
$di->getLogger()->error("You must specify a language file for language '{$code}'");
$path = ROOT_DIR . 'core/lang/messages/en.php';
}
$translation = new NativeArray(['content' => require_once $path]);
}
return $translation;
}, true);
//Queue to deliver e-mails in real-time