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


PHP Session::get方法代码示例

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


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

示例1: getHtml

    public function getHtml()
    {
        $transHtml = array();
        $request = $this->controller->getRequest();
        if ($this->controller instanceof CheckoutController && $request->getActionName() == 'completed') {
            $session = new Session();
            if ($orderID = $session->get('completedOrderID')) {
                $order = CustomerOrder::getInstanceByID((int) $session->get('completedOrderID'), CustomerOrder::LOAD_DATA);
                $order->loadAll();
                $orderArray = $order->toArray();
                $data = array($order->getID(), '', $orderArray['total'][$orderArray['Currency']['ID']], $order->getTaxAmount(), $orderArray['ShippingAddress']['city'], $orderArray['ShippingAddress']['stateName'], $orderArray['ShippingAddress']['countryID']);
                $transHtml[] = 'pageTracker._addTrans' . $this->getJSParams($data);
                foreach ($orderArray['cartItems'] as $item) {
                    $data = array($order->getID(), $item['Product']['sku'], $item['Product']['name'], $item['Product']['Category']['name'], $item['price'], $item['count']);
                    $transHtml[] = 'pageTracker._addItem' . $this->getJSParams($data);
                }
            }
            $transHtml[] = 'pageTracker._trackTrans();';
        }
        return '<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("' . $this->getValue('code') . '");
pageTracker._initData();
pageTracker._trackPageview();
' . implode("\n", $transHtml) . '
</script>';
    }
开发者ID:saiber,项目名称:livecart,代码行数:30,代码来源:GoogleAnalytics.php

示例2: __construct

 /**
  * Returns an instance of this class
  *
  * @param Controller $controller
  * @param string $name
  */
 public function __construct($controller, $name)
 {
     $fields = new FieldList(array(new HiddenField('AuthenticationMethod', null, $this->authenticator_class)));
     $actions = new FieldList(array(FormAction::create('redirectToRealMe', _t('RealMeLoginForm.LOGINBUTTON', 'LoginAction'))->setUseButtonTag(true)->setButtonContent('<span class="realme_button_padding">Login or register with RealMe<span class="realme_icon_new_window"></span> <span class="realme_icon_padlock"></span>')->setAttribute('class', 'realme_button')));
     // Taken from MemberLoginForm
     if (isset($_REQUEST['BackURL'])) {
         $backURL = $_REQUEST['BackURL'];
     } elseif (Session::get('BackURL')) {
         $backURL = Session::get('BackURL');
     }
     if (isset($backURL)) {
         // Ensure that $backURL isn't redirecting us back to login form or a RealMe authentication page
         if (strpos($backURL, 'Security/login') === false && strpos($backURL, 'Security/realme') === false) {
             $fields->push(new HiddenField('BackURL', 'BackURL', $backURL));
         }
     }
     // optionally include requirements {@see /realme/_config/config.yml}
     if ($this->config()->include_jquery) {
         Requirements::javascript(THIRDPARTY_DIR . "/jquery/jquery.js");
     }
     if ($this->config()->include_javascript) {
         Requirements::javascript(REALME_MODULE_PATH . "/javascript/realme.js");
     }
     if ($this->config()->include_css) {
         Requirements::css(REALME_MODULE_PATH . "/css/realme.css");
     }
     parent::__construct($controller, $name, $fields, $actions);
 }
开发者ID:helpfulrobot,项目名称:silverstripe-realme,代码行数:34,代码来源:RealMeLoginForm.php

示例3: testGet

 /**
  * @covers $this->object->get
  * @todo   Implement testGet().
  */
 public function testGet()
 {
     session_start();
     $_SESSION['test'] = 'TEST';
     $this->assertEquals($this->object->get('test'), 'TEST');
     $this->assertEquals($this->object->get('bogus', false), false);
 }
开发者ID:PermeAgility,项目名称:FrameworkBenchmarks,代码行数:11,代码来源:sessionTest.php

示例4: printError

function printError($error, Session $session)
{
    if (isset($session->get("errors")[$error])) {
        echo $session->get("errors")[$error];
    } else {
        echo "";
    }
}
开发者ID:patrickbraud,项目名称:CapstoneProject,代码行数:8,代码来源:register.php

示例5: country

 /**
  * Change country
  *
  * @param  string  $country
  */
 public function country($country)
 {
     if (in_array($country, Kohana::config('site.countries'))) {
         if ($this->session->get('country') == $country) {
             // Clear country if same as given
             $this->session->delete('country');
         } else {
             // Set country
             $this->session->set('country', $country);
         }
     }
     url::back();
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:18,代码来源:set.php

示例6: __construct

 function __construct()
 {
     parent::__construct();
     if (Session::get("logged_in")) {
         header("Location: " . URL . "index");
     }
 }
开发者ID:DvOtterloo,项目名称:Questionmark,代码行数:7,代码来源:login_controller.php

示例7: __construct

 public function __construct()
 {
     // Asset::add('jquery.dropdown.css', 'css/jquery.dropdown.css');
     Asset::add('bootstrap', 'css/bootstrap.min.css');
     Asset::add('bootstrap-responsive', 'css/bootstrap-responsive.css');
     Asset::add('common', 'css/common.css');
     // Asset::add('style', 'css/style.css');
     Asset::add('fontawsome', 'css/fontawesome.css');
     Asset::add('flickcss', 'css/flick/jquery-ui-1.10.2.custom.css');
     Asset::add('jquery', 'js/jquery-1.9.1.js');
     Asset::add('jquery-migrate-1.1.1.js', 'js/jquery-migrate-1.1.1.js');
     Asset::add('bootstrap-js', 'js/bootstrap.js');
     Asset::add('jqueryui', 'js/jquery-ui-1.10.2.custom.min.js');
     Asset::add('jquery.tablesorter.js', 'js/jquery.tablesorter.js');
     Asset::add('jquery.tablesorter.pager.js', 'js/jquery.tablesorter.pager.js');
     // $files = glob("public/css/pikachoose/*.css", GLOB_BRACE);
     // foreach($files as $file)
     // {
     // 	Asset::add($file, substr($file, 7));
     // }
     if (Session::has('id') && Auth::check()) {
         $account = Account::find(Session::get('id'));
         if ($account->admin == 1) {
             Session::put('admin', '1');
         } else {
             Session::put('admin', '0');
         }
         if ($account->blocked == 1) {
             Session::put('alert', "Your account has been banned. Please contact the admin for more details");
             Session::forget('id');
             Auth::logout();
         } else {
         }
     }
 }
开发者ID:angmark0309,项目名称:remarket,代码行数:35,代码来源:base.php

示例8: comprobarErrores

 /**
  * Método que comprueba si existen errores en la sessión
  * @return Boolean True = cuando no hay errores, False = cuando hay errores
  */
 public static function comprobarErrores()
 {
     if (Session::get('feedback_negative')) {
         return false;
     }
     return true;
 }
开发者ID:khru,项目名称:MVC-oferta,代码行数:11,代码来源:Session.php

示例9: MarketPlaceReviewForm

 public function MarketPlaceReviewForm()
 {
     Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js");
     Requirements::javascript(Director::protocol() . "ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js");
     Requirements::combine_files('marketplace_review_form.js', array("themes/openstack/javascript/jquery.validate.custom.methods.js", "marketplace/code/ui/frontend/js/star-rating.min.js", "marketplace/code/ui/frontend/js/marketplace.review.js"));
     $css_files = array("marketplace/code/ui/frontend/css/star-rating.min.css", "marketplace/code/ui/frontend/css/marketplace-review.css");
     foreach ($css_files as $css_file) {
         Requirements::css($css_file);
     }
     $form = new MarketPlaceReviewForm($this, 'MarketPlaceReviewForm');
     $data = Session::get("FormInfo.Form_MarketPlaceReviewForm.data");
     $review = $this->review_repository->getReview($this->company_service_ID, Member::CurrentUserID());
     if (is_array($data)) {
         //get data from cache
         $form->loadDataFrom($data);
     } elseif ($review) {
         // get submitted review
         $form->loadDataFrom($review);
     }
     // Optional spam protection
     if (class_exists('SpamProtectorManager')) {
         SpamProtectorManager::update_form($form);
     }
     return $form;
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:25,代码来源:MarketPlaceDirectoryPage.php

示例10: post_login

 public function post_login()
 {
     $errors = new Laravel\Messages();
     $input = Input::get();
     try {
         $validator = new Services\Session\Login\Validator($input);
         $validator->publish();
     } catch (ValidateException $errors) {
         return Redirect::to(URL::to_route('session.login'))->with_input()->with_errors($errors->get());
     }
     try {
         $valid_login = Sentry::login(Input::get('email'), Input::get('password'), Input::get('remember-me'));
         if ($valid_login) {
             $url = null;
             if (Session::has('pre_login_url')) {
                 $url = Session::get('pre_login_url');
                 Session::forget('pre_login_url');
             } else {
                 $url = URL::to_route('dashboard.profile');
             }
             return Redirect::to($url);
         } else {
             $errors->add('errors', __('application.invalid_login'));
             return Redirect::to(URL::to_route('session.login'))->with_input()->with_errors($errors);
         }
     } catch (Sentry\SentryException $e) {
         $errors->add('errors', $e->getMessage());
         return Redirect::to(URL::to_route('session.login'))->with_input()->with_errors($errors);
     }
 }
开发者ID:jvillasante,项目名称:cubanartjb,代码行数:30,代码来源:session.php

示例11: __construct

 function __construct()
 {
     parent::__construct();
     if (Session::get('user_login')) {
         echo '<script type="text/javascript"> window.location.replace("' . URL . 'dashboard") </script>';
     }
 }
开发者ID:shaunzeng,项目名称:a-mvc-boilerplate-written-in-php,代码行数:7,代码来源:login.php

示例12: exeCheck

 function exeCheck()
 {
     $id = Session::get('user')['id'];
     $userId = (int) Request::post('userId');
     $status = (int) Request::post('status');
     if ($id > 0 && $userId > 0) {
         $array = array();
         switch ($status) {
             case '-1':
                 if ($this->exeInsert($id, $userId) > 0) {
                     $array = array('status' => 1, 'text' => 'Đang gửi yêu cầu');
                 }
                 break;
             case '0':
                 if ($this->exeHandling($userId, $id, 1) > 0) {
                     $array = array('status' => 2, 'text' => 'Bạn bè');
                 }
                 break;
             case '1':
                 if ($this->exeDelete($userId, $id) > 0) {
                     $array = array('status' => -1, 'text' => 'Kết bạn');
                 }
                 break;
             case '2':
                 if ($this->exeDelete($userId, $id) > 0) {
                     $array = array('status' => -1, 'text' => 'Kết bạn');
                 }
                 break;
         }
         echo json_encode($array);
     } else {
         exit;
     }
 }
开发者ID:noikiy,项目名称:lovetolove,代码行数:34,代码来源:Relationship.php

示例13: init

 /**
  * Allow this controller to be viewed when the site is in draft mode.
  */
 function init()
 {
     $draftsecurity = Session::get('unsecuredDraftSite');
     Session::set("unsecuredDraftSite", true);
     parent::init();
     Session::set("unsecuredDraftSite", $draftsecurity);
 }
开发者ID:helpfulrobot,项目名称:burnbright-silverstripe-shop-productfinder,代码行数:10,代码来源:ProductFinder.php

示例14: putChangePassword

 /**
  * 动作:修改当前账号密码
  * @return Response
  */
 public function putChangePassword()
 {
     $response = array();
     // 获取所有表单数据
     $data = Input::all();
     $admin = Session::get("admin");
     // 验证旧密码
     if (!Hash::check($data['password_old'], $admin->pwd)) {
         $response['success'] = false;
         $response['message'] = '原始密码错误';
         return Response::json($response);
     }
     // 创建验证规则
     $rules = array('password' => 'alpha_dash|between:6,16|confirmed');
     // 自定义验证消息
     $messages = array('password.alpha_dash' => '密码格式不正确。', 'password.between' => '密码长度请保持在:min到:max位之间。', 'password.confirmed' => '两次输入的密码不一致。');
     // 开始验证
     $validator = Validator::make($data, $rules, $messages);
     if ($validator->passes()) {
         // 验证成功
         // 更新用户
         $admin->pwd = Hash::make(Input::get('password'));
         if ($admin->save()) {
             $response['success'] = true;
             $response['message'] = '密码修改成功';
         } else {
             $response['success'] = false;
             $response['message'] = '密码修改失败';
         }
     } else {
         $response['success'] = false;
         $response['message'] = $validator->errors->first();
     }
     return Response::json($response);
 }
开发者ID:Kangaroos,项目名称:oneshike,代码行数:39,代码来源:AdminController.php

示例15: get

 public static function get($var)
 {
     if (!Session::has($var)) {
         return false;
     }
     return Session::get($var);
 }
开发者ID:birdiebel,项目名称:x2016,代码行数:7,代码来源:mySession.php


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