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


PHP Session::save方法代码示例

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


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

示例1: setSessionValues

 /**
  * @param array $sessionValues
  */
 public function setSessionValues($sessionValues)
 {
     if (is_array($sessionValues)) {
         foreach ($sessionValues as $key => $value) {
             $longKey = $this->namespace . $key;
             $this->session->set($longKey, $value);
         }
         $this->session->save();
     }
 }
开发者ID:vmille,项目名称:TuleapRestApiBridge,代码行数:13,代码来源:Session.php

示例2: indexAction

 /**
  * @Route("/", name="homepage")
  */
 public function indexAction(Request $request)
 {
     //start session
     $session = new Session(new PhpBridgeSessionStorage());
     $session->start();
     $session->set('date', time());
     //get products from DB
     $products = $this->getDoctrine()->getRepository('AppBundle:Cart')->findAll();
     //get session products
     $sessionProducts = $session->get('products');
     $productArray = null;
     //if post save to db && session
     if ($request->isMethod('post')) {
         $postProduct = [$request->request->get('product')];
         if (!empty($sessionProducts)) {
             $productArray = array_merge($sessionProducts, $postProduct);
         } else {
             $productArray = $postProduct;
         }
         $productArray = array_unique($productArray);
     }
     $session->set('products', $productArray);
     // this helps create cookie for session
     $session->save();
     return $this->render('default/index.html.twig', array('sessionProducts' => $productArray, 'products' => $products));
 }
开发者ID:grzegab,项目名称:cart,代码行数:29,代码来源:DefaultController.php

示例3: logout

 /**
  * Remove all session variables upon logout
  */
 public function logout()
 {
     $this->session->remove('loggedIn');
     $this->session->remove('name');
     $this->session->remove('username');
     $this->session->remove('password');
     $this->session->remove('user_id');
     $this->session->save();
 }
开发者ID:jorions,项目名称:acashop,代码行数:12,代码来源:LoginService.php

示例4: mapAction

 /**
  * @Route("/map", name="map")
  * @Template()
  */
 public function mapAction(Request $request)
 {
     $session = new Session();
     $refer = $request->headers->get('referer');
     if ($request->query->get('my') == '0' && $session->get('referer') != null) {
         if ($session->get('referer') != $refer) {
             $refer = $session->get('referer');
             $session->set('referer', null);
             return $this->redirect($refer);
         }
     }
     if ($request->query->get('my') == 1 && $session->get('lists') == null) {
         return $this->redirect($this->generateUrl('map'));
     }
     $session->set('referer', $refer);
     $session->save();
     //        }
     $params = array('grpMin' => $request->query->get('grp-min'), 'grpMax' => $request->query->get('grp-max'), 'otsMin' => $request->query->get('ots-min'), 'otsMax' => $request->query->get('ots-max'), 'priceMin' => $request->query->get('price-min'), 'priceMax' => $request->query->get('price-max'), 'area' => $request->query->get('area'), 'formatS' => $request->query->get('formatS'), 'formatM' => $request->query->get('formatM'), 'formatL' => $request->query->get('formatL'), 'formatSB' => $request->query->get('formatSB'), 'light' => $request->query->get('light'), 'street' => $request->query->get('street'), 'city' => $request->query->get('city'), 'hot' => $request->query->get('hot'), 'dateStart' => $request->query->get('dateStart'), 'dateEnd' => $request->query->get('dateEnd'));
     if ($params['formatS'] == null) {
         $params['formatS'] = 1;
     }
     if ($params['formatM'] == null) {
         $params['formatM'] = 1;
     }
     if ($params['formatL'] == null) {
         $params['formatL'] = 1;
     }
     if ($params['formatSB'] == null) {
         $params['formatSB'] = 1;
     }
     if ($request->query->get('city')) {
         $city = $request->query->get('city') . ', ';
     } else {
         $city = 'Москва,';
     }
     if ($request->query->get('area')) {
         $area = $request->query->get('area') . ', ';
     } else {
         $area = '';
     }
     if ($request->query->get('my') == 1) {
         $basket = $session->get('lists');
         if (isset($basket) && $basket != null && isset(array_values($basket)[0])) {
             $val = array_values($basket)[0]['city'];
         } else {
             $val = 'Москва';
         }
     } else {
         $val = $city . ' ' . $area . ' ' . $request->query->get('street');
     }
     $url = 'http://geocode-maps.yandex.ru/1.x/?geocode=' . urlencode($val);
     $content = file_get_contents($url);
     $XmlObj = simplexml_load_string($content);
     if (isset($XmlObj->GeoObjectCollection->featureMember->GeoObject->Point->pos)) {
         $pos['x'] = explode(' ', $XmlObj->GeoObjectCollection->featureMember->GeoObject->Point->pos)[1];
         $pos['y'] = explode(' ', $XmlObj->GeoObjectCollection->featureMember->GeoObject->Point->pos)[0];
     } else {
         $pos['x'] = null;
         $pos['y'] = null;
     }
     $id = $request->query->get('bannerId');
     if ($id) {
         $thisBanner = $this->getDoctrine()->getRepository('AppBundle:Banner')->findOneById($id);
     } else {
         $thisBanner = null;
     }
     $lists = array();
     $i = 0;
     $grp = 0;
     $ots = 0;
     $ots2 = 0;
     $sideA = 0;
     $side = '';
     $sideB = 0;
     $price = 0;
     $price2 = 0;
     $fullprice = 0;
     $session = $request->getSession();
     $basket = $session->get('lists');
     if ($basket) {
         foreach ($basket as $key => $val) {
             $i++;
             //                $lists[] = $this->getDoctrine()->getRepository('AppBundle:Banner')->findOneById($key);
             $grp += $val['grp'];
             $ots += $val['ots'];
             if (strripos($val['side'], 'A') !== false || strripos($val['side'], 'А') !== false) {
                 $sideA++;
             } else {
                 $sideB++;
             }
             $price += $val['price'];
             $price2 += $val['price2'];
         }
         $lists = $basket;
         $grp = $grp / $i;
         $ots2 = $ots;
//.........这里部分代码省略.........
开发者ID:Quiss,项目名称:Oon,代码行数:101,代码来源:DefaultController.php

示例5: writeSession

 /**
  * Writes the session.
  *
  * @return void
  */
 protected function writeSession()
 {
     $this->session->save();
 }
开发者ID:Webapper,项目名称:silex-sentinel-service-provider,代码行数:9,代码来源:SilexSession.php

示例6: save

 /**
  * {@inheritDoc}
  *
  * Also persists container services.
  *
  * @see peristServices
  */
 public function save()
 {
     $this->persistServices();
     parent::save();
 }
开发者ID:zenmagick,项目名称:zenmagick,代码行数:12,代码来源:Session.php

示例7: save

 /**
  * {@inheritdoc}
  */
 public function save()
 {
     $this->ageFlashData();
     return parent::save();
 }
开发者ID:trangunghoa,项目名称:l4cms,代码行数:8,代码来源:Store.php

示例8: processResponse

 /**
  * {@inheritdoc}
  */
 public function processResponse(Request $request, Response $response)
 {
     if ($this->session->isStarted()) {
         $this->session->save();
     }
 }
开发者ID:brainexe,项目名称:core,代码行数:9,代码来源:Session.php

示例9: DownloadString2File

/**
 * \brief send a string to a user as a download file
 *
 * \param $text - text to download as file
 * \param $name - file name
 * \param $contentType - download file Content-Type
 * 
 * \return True on success, error message on failure.
 */
function DownloadString2File($text, $name, $contentType)
{
    $connstat = connection_status();
    if ($connstat != 0) {
        return _("Lost connection.");
    }
    $session = new Session();
    $session->save();
    ob_end_clean();
    header("Expires: " . gmdate("D, d M Y H:i:s", mktime(date("H") + 2, date("i"), date("s"), date("m"), date("d"), date("Y"))) . " GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header('Content-Description: File Transfer');
    header("Content-Type: {$contentType}");
    header("Content-Length: " . (string) strlen($text));
    header("Content-Disposition: attachment; filename=\"{$name}\"");
    header("Content-Transfer-Encoding: binary\n");
    echo $text;
    if (connection_status() == 0 and !connection_aborted()) {
        return True;
    }
    return _("Lost connection.");
}
开发者ID:DanielDobre,项目名称:fossology,代码行数:31,代码来源:common-ui.php

示例10: impersonate

 /**
  * {@inheritdoc}
  */
 public function impersonate(UserInterface $user)
 {
     $token = new UsernamePasswordToken($user, $user->getPassword(), $this->sessionTokenParameter, $user->getRoles());
     $this->session->set($this->sessionTokenParameter, serialize($token));
     $this->session->save();
 }
开发者ID:sylius,项目名称:sylius,代码行数:9,代码来源:UserImpersonator.php

示例11: setFeature

 /**
  * Set the feature to the enclosed status, under the given context
  *
  * @param ContextInterface $context
  * @param FeatureInterface $feature
  * @return void
  */
 public function setFeature(ContextInterface $context, FeatureInterface $feature)
 {
     $this->bag->set($feature->getName(), $feature->getConfiguration());
     $this->session->save();
 }
开发者ID:vend,项目名称:pheat-bundle,代码行数:12,代码来源:SessionProvider.php


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