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


PHP Session::close方法代码示例

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


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

示例1: afterAction

 /**
  * @param \yii\base\Action $action
  * @param mixed $result
  * @return mixed
  */
 public function afterAction($action, $result)
 {
     if ($this->session->isActive) {
         $this->session->close();
     }
     return parent::afterAction($action, $result);
 }
开发者ID:jc21,项目名称:snippets-site,代码行数:12,代码来源:Controller.php

示例2: actionLogin

 public function actionLogin()
 {
     $modelLoginFrom = new LoginForm();
     if ($modelLoginFrom->load(\Yii::$app->getRequest()->getBodyParams(), '') && $modelLoginFrom->login()) {
         $post = \Yii::$app->getRequest()->getBodyParams();
         $modelUser = new User();
         $modelRole = new Role();
         $result = $modelRole->find()->where(['=', 'role_id', \Yii::$app->user->identity->getRole()])->all();
         $resultuserdata = $modelUser->find()->where(['=', 'username', $post['username']])->one();
         $session = new Session();
         $session->open();
         $session->set('role', $result[0]->name);
         $session->close();
         return ['username' => $post['username'], 'role' => $result[0]->name, 'isLogined' => true, 'userDataID' => $resultuserdata->user_data_id];
     } else {
         return $modelLoginFrom;
     }
 }
开发者ID:romangrb,项目名称:resource-registry,代码行数:18,代码来源:UserController.php

示例3: actionToggleAdminEyes

 public function actionToggleAdminEyes()
 {
     $session = new Session();
     $session->open();
     $session['eyes_admin'] = !$session['eyes_admin'];
     $session->close();
     return $this->redirect(Yii::$app->request->referrer);
 }
开发者ID:bryantmakesprog,项目名称:TwitterClone,代码行数:8,代码来源:TweetController.php

示例4: actionSetwindowguid

 public function actionSetwindowguid()
 {
     $guid = (string) filter_input(INPUT_POST, 'guid');
     $pathname = (string) filter_input(INPUT_POST, 'path');
     $search = (string) filter_input(INPUT_POST, 'search');
     $session = new Session();
     $session->open();
     $res = isset($session['WindowsGUIDs']) ? $session['WindowsGUIDs'] : [];
     $currentguid = $session['WindowsGUIDCurrent'];
     $gohome = false;
     $homeurls = ["", "?r=site%2Findex", "?r=site%2Flogin", "?r=site%2Flogout", "?r=site%2Ferror"];
     $ishome = in_array($search, $homeurls);
     if (empty($guid)) {
         // Если новая вкладка
         for ($i = 0; $i < 6; $i++) {
             $guid .= dechex(rand(0, 15));
         }
         $res[$guid] = 1;
         $session['WindowsGUIDs'] = $res;
         $session['WindowsGUIDCurrent'] = $guid;
         $gohome = !$ishome;
     } else {
         // Если существующая вкладка
         if ($session['WindowsGUIDCurrent'] === $guid) {
             // Если текущая вкладка
         } else {
             // Если другая существующая вкладка
             $session['WindowsGUIDCurrent'] = $guid;
             $gohome = !$ishome;
         }
         $session['WindowsGUIDs'] = $res;
     }
     $session->close();
     echo json_encode((object) ['guid' => $guid, 'gohome' => $gohome]);
 }
开发者ID:vovancho,项目名称:yii2test,代码行数:35,代码来源:SiteController.php

示例5: isset

          ),
          ]);
          NavBar::end();
          } */
?>

        <?php 
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], 'homeLink' => ['url' => Yii::$app->homeUrl, 'label' => '<span class="bc_lighter"></span><i class="glyphicon glyphicon-home"></i>', 'encode' => false]]);
?>

        <?php 
if (!isset($this->params['breadcrumbs'])) {
    $session = new Session();
    $session->open();
    $session->remove('breadcrumbs');
    $session->close();
}
?>
        <?php 
echo $content;
?>
    </div>
    <div class="buttonside" id="scrollupbutton" style="display: none;">
        <span>ВВЕРХ</span>
    </div>

    <a class="buttonside" id="backbutton" href="<?php 
echo Proc::GetPreviousURLBreadcrumbsFromSession() === Yii::$app->homeUrl ? '#' : Proc::GetPreviousURLBreadcrumbsFromSession();
?>
" style="display: none;">
        <span>НАЗАД</span>
开发者ID:vovancho,项目名称:yii2test,代码行数:31,代码来源:main.php

示例6: AssignToModelFromGrid

 /**
  * Присваивает выбранное значение из справочника модели, в сессии.
  * При выборе значения из справочника, значение присваивается в сессию предыдущей хлебной крошки, для формы, с которой был открыт справочник.
  * @param bool $RedirectPreviousUrl
  * @param ActiveRecord $ActiveRecord Модель к которой присваивается знаечния из справочника.
  * @param string $AttributeForeignID Имя атрибута
  * @return string
  */
 public static function AssignToModelFromGrid($RedirectPreviousUrl = True, $ActiveRecord = NULL, $AttributeForeignID = NULL)
 {
     if (Yii::$app->request->isAjax) {
         $LastBC = Proc::GetLastBreadcrumbsFromSession();
         $assigndata = filter_input(INPUT_POST, 'assigndata');
         $foreign = isset($LastBC['dopparams']['foreign']) ? $LastBC['dopparams']['foreign'] : '';
         if (!empty($foreign) && !empty($assigndata)) {
             $BC = Proc::GetBreadcrumbsFromSession();
             end($BC);
             prev($BC);
             $BC[key($BC)]['dopparams'][$foreign['model']][$foreign['field']] = $assigndata;
             $session = new Session();
             $session->open();
             $session['breadcrumbs'] = $BC;
             $session->close();
             if ($ActiveRecord instanceof ActiveRecord && is_string($AttributeForeignID)) {
                 $field = $LastBC['dopparams']['foreign']['field'];
                 if ($ActiveRecord->formName() === $LastBC['dopparams']['foreign']['model']) {
                     $ActiveRecord->{$field} = $assigndata;
                     $ActiveRecord->{$AttributeForeignID} = $foreign['id'];
                     if ($ActiveRecord->validate()) {
                         $ActiveRecord->save(false);
                     }
                 }
             }
             if ($RedirectPreviousUrl) {
                 Yii::$app->response->redirect(Proc::GetPreviousURLBreadcrumbsFromSession());
             }
         } else {
             return 'error foreign or assigndata empty AssignToModelFromGrid()';
         }
     }
 }
开发者ID:vovancho,项目名称:yii2test,代码行数:41,代码来源:Proc.php


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