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


PHP Session::getId方法代碼示例

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


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

示例1: testRegenerateId

 /**
  * Test session id regeneration.
  * @return void
  */
 public function testRegenerateId()
 {
     $this->session->start();
     $oldId = $this->session->getId();
     $this->session->regenerateId();
     $newId = $this->session->getId();
     $this->assertNotEquals($newId, $oldId);
 }
開發者ID:vrana,項目名稱:nette,代碼行數:12,代碼來源:NetteWebSessionTest.php

示例2: reGenerateSession

 public function reGenerateSession()
 {
     $newSession = new Session();
     $newSession->setIpAddress($this->getIpAddress());
     $newSession->setStatus($this->getStatus());
     $newSession->setUser($this->getUser());
     $newSession->setShippingClass($this->getShippingClass());
     $newSession->setPaymentClass($this->getPaymentClass());
     $newSession->save();
     $_SESSION["ECommSessionId"] = $newSession->getId();
     return $newSession->getId();
 }
開發者ID:anas,項目名稱:feedstore,代碼行數:12,代碼來源:Session.php

示例3: getIndex

 public function getIndex($option = null)
 {
     Session::put('curr_page', URL::full());
     $view = View::make('home');
     $view['sid'] = Session::getId();
     return $view;
 }
開發者ID:kierkegaard13,項目名稱:graph-generator,代碼行數:7,代碼來源:home.php

示例4: __construct

 public function __construct()
 {
     self::$url = 'https://www.google-analytics.com/collect';
     self::$version = '1';
     self::$trackingID = $_ENV['GOOGLE_TRACKING_CODE'];
     self::$clientID = Session::getId();
 }
開發者ID:neraunzaran,項目名稱:fruit-dashboard,代碼行數:7,代碼來源:GoogleTracker.php

示例5: beforeCreate

 public function beforeCreate()
 {
     $this->login_at = new Carbon();
     $this->ip = \Request::getClientIp();
     $this->session_id = \Session::getId();
     return true;
 }
開發者ID:srit83,項目名稱:extsentry,代碼行數:7,代碼來源:Login.php

示例6: getCurrentMember

 /**
  * Returns the current member based on the session id
  * @return Member
  */
 private function getCurrentMember()
 {
     if (!$this->currentMember && !($this->currentMember = Member::currentMember()->first())) {
         $this->currentMember = Member::create(['session_id' => \Session::getId()]);
     }
     return $this->currentMember;
 }
開發者ID:Sparclex,項目名稱:studie,代碼行數:11,代碼來源:SurveyController.php

示例7: recordLogout

 public function recordLogout()
 {
     if ($oLogin = Login::lastLoginWithIpAndSession(\Request::getClientIp(), \Session::getId())->first()) {
         $oLogin->logout();
     }
     return true;
 }
開發者ID:srit83,項目名稱:extsentry,代碼行數:7,代碼來源:User.php

示例8: repoDecodeWeb

 public static function repoDecodeWeb($repo)
 {
     $ret = \Dcrypt\Aes::decrypt(base32_decode($repo), self::key . \Session::getId() . self::githubId());
     if ($ret === false) {
         \App::abort(500);
     }
     return $ret;
 }
開發者ID:apigen-ci,項目名稱:apigen-ci,代碼行數:8,代碼來源:Model.php

示例9: outputCredential

 /**
  * Called by web server<br>
  * 生成並返回憑證。生成的憑證默認存儲在Session裏。<br>
  * 你可以改寫該函數,存儲在數據庫、文件裏、Memcache裏都行。憑證數據結構也可以改。
  * @return array
  */
 public function outputCredential()
 {
     $token = str_random(40);
     $sessionId = \Session::getId();
     $credential = array(\Crypt::encrypt($sessionId), \Crypt::encrypt($token));
     \Session::put($this->tokenKey, $token);
     return $credential;
 }
開發者ID:Hehe-Zhc,項目名稱:workerboy,代碼行數:14,代碼來源:CredentialProcessor.php

示例10: getValidFileValidatorFunction

 public static function getValidFileValidatorFunction()
 {
     return function ($attribute, $value, $parameters) {
         $value = intval($value, 10);
         $file = File::find($value);
         return !is_null($file) && ($file->in_use || !is_null($file->session_id) && $file->session_id === Session::getId());
     };
 }
開發者ID:joshhodgson,項目名稱:Website,代碼行數:8,代碼來源:FormHelpers.php

示例11: sessionRemove

 /**
  * To Trigger BEFORE Auth logout
  * 
  * Send Laravel's Session Id and User Id to server
  * via ZMQ before client's websocket connection
  * 
  * @return [type] [description]
  */
 public function sessionRemove()
 {
     $arr = ['session_id' => \Session::getId()];
     if (\Auth::check()) {
         $arr = ['session_id' => \Session::getId(), 'remove_id' => \Auth::id()];
     }
     \Larapush::sync($arr);
 }
開發者ID:redbaron76,項目名稱:larapush,代碼行數:16,代碼來源:LarapushFilter.php

示例12: testSetAndGetAndRegenerateId

 /**
  * @runInSeparateProcess
  */
 public function testSetAndGetAndRegenerateId()
 {
     Session::start();
     Session::setId('1ab2c3d4e5f6g7h8i9');
     $this->assertEquals('1ab2c3d4e5f6g7h8i9', Session::getId());
     Session::regenerateId();
     $this->assertNotEquals('1ab2c3d4e5f6g7h8i9', Session::getId());
 }
開發者ID:titaniumphp,項目名稱:sessionmanager,代碼行數:11,代碼來源:SessionTest.php

示例13: postNew

 public function postNew()
 {
     $question = new Question();
     $question->title = Input::get('title');
     $question->question = Input::get('question');
     $question->answer = Input::get('answer');
     $question->last_session = Session::getId();
     $question->create_by = 1;
     //Sentry::getUser()->id;
     $question->view_count = 0;
     $question->is_visible = Input::get('is_visible', '1');
     $question->pin = Input::get('pin', '0');
     $question->save();
     return Redirect::to('faq');
 }
開發者ID:gitda,項目名稱:inventory2,代碼行數:15,代碼來源:FaqController.php

示例14: postRegister

 /**
  * Handle a registration request for the application.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postRegister(Request $request)
 {
     $validator = $this->validator($request->all());
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     $user = $this->create($request->all());
     $previous_session = $user->session_id;
     if ($previous_session) {
         \Session::getHandler()->destroy($previous_session);
         Auth::setUser($user);
         Auth::logout();
     }
     Auth::login($user, $request->has('remember'));
     $user->session_id = \Session::getId();
     $user->save();
     return redirect($this->redirectPath());
 }
開發者ID:jzengg,項目名稱:LaravelApp,代碼行數:24,代碼來源:RegistersUsers.php

示例15: handleUserWasAuthenticated

 /**
  * Send the response after the user was authenticated.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  bool  $throttles
  * @return \Illuminate\Http\Response
  */
 protected function handleUserWasAuthenticated(Request $request, $throttles)
 {
     if ($throttles) {
         $this->clearLoginAttempts($request);
     }
     // if (method_exists($this, 'authenticated')) {
     //     return $this->authenticated($request, Auth::user());
     // }
     $user = Auth::getLastAttempted();
     $previous_session = $user->session_id;
     if ($previous_session) {
         \Session::getHandler()->destroy($previous_session);
         Auth::setUser($user);
         Auth::logout();
     }
     Auth::login($user, $request->has('remember'));
     $user->session_id = \Session::getId();
     $user->save();
     return redirect()->intended($this->redirectPath());
 }
開發者ID:jzengg,項目名稱:LaravelApp,代碼行數:27,代碼來源:AuthenticatesUsers.php


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