當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。