當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Container::redirect方法代碼示例

本文整理匯總了PHP中Pimple\Container::redirect方法的典型用法代碼示例。如果您正苦於以下問題:PHP Container::redirect方法的具體用法?PHP Container::redirect怎麽用?PHP Container::redirect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Pimple\Container的用法示例。


在下文中一共展示了Container::redirect方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: register

 public function register(\Pimple\Container $app)
 {
     $app['steam_auth'] = function () use($app) {
         $openid = new \LightOpenID($app['steam_auth.host']);
         $openid->identity = 'http://steamcommunity.com/openid';
         return $openid;
     };
     $app['security.authentication_listener.factory.steam_auth'] = $app->protect(function ($name, $options) use($app) {
         $options = array_replace_recursive(array('check_path' => '/login/steamauthcheck'), $options);
         if (!isset($app['security.authentication.success_handler.' . $name])) {
             $app['security.authentication.success_handler.' . $name] = $app['security.authentication.success_handler._proto']($name, $options);
         }
         if (!isset($app['security.authentication.failure_handler.' . $name])) {
             $app['security.authentication.failure_handler.' . $name] = $app['security.authentication.failure_handler._proto']($name, $options);
         }
         // define the authentication provider object
         if (!isset($app['security.authentication_provider.' . $name . '.steam_auth'])) {
             $app['security.authentication_provider.' . $name . '.steam_auth'] = function () use($app, $name) {
                 return new SteamAuthProvider($app['security.user_provider.' . $name]);
             };
         }
         // define the authentication listener object
         if (!isset($app['security.authentication_listener.' . $name . '.steam_auth'])) {
             $app['security.authentication_listener.' . $name . '.steam_auth'] = function () use($app, $name, $options) {
                 return new SteamAuthListener($app['steam_auth'], $app['security.token_storage'], $app['security.authentication_manager'], isset($app['security.session_strategy.' . $name]) ? $app['security.session_strategy.' . $name] : $app['security.session_strategy'], $app['security.http_utils'], $name, $app['security.authentication.success_handler.' . $name], $app['security.authentication.failure_handler.' . $name], $options, $app['logger'], $app['dispatcher']);
             };
         }
         $bindName = "steam_auth_{$name}_";
         $app->match($options['check_path'], function () {
         })->bind($bindName . 'check');
         $app->match('/login', function () use($app, $bindName) {
             return $app->redirect($app['url_generator']->generate($bindName . 'check'));
         });
         return array('security.authentication_provider.' . $name . '.steam_auth', 'security.authentication_listener.' . $name . '.steam_auth', null, 'pre_auth');
     });
 }
開發者ID:rafalniewinski,項目名稱:silex-steamauth,代碼行數:36,代碼來源:SteamAuthServiceProvider.php


注:本文中的Pimple\Container::redirect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。