本文整理汇总了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);
}
示例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();
}
示例3: getIndex
public function getIndex($option = null)
{
Session::put('curr_page', URL::full());
$view = View::make('home');
$view['sid'] = Session::getId();
return $view;
}
示例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();
}
示例5: beforeCreate
public function beforeCreate()
{
$this->login_at = new Carbon();
$this->ip = \Request::getClientIp();
$this->session_id = \Session::getId();
return true;
}
示例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;
}
示例7: recordLogout
public function recordLogout()
{
if ($oLogin = Login::lastLoginWithIpAndSession(\Request::getClientIp(), \Session::getId())->first()) {
$oLogin->logout();
}
return true;
}
示例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;
}
示例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;
}
示例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());
};
}
示例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);
}
示例12: testSetAndGetAndRegenerateId
/**
* @runInSeparateProcess
*/
public function testSetAndGetAndRegenerateId()
{
Session::start();
Session::setId('1ab2c3d4e5f6g7h8i9');
$this->assertEquals('1ab2c3d4e5f6g7h8i9', Session::getId());
Session::regenerateId();
$this->assertNotEquals('1ab2c3d4e5f6g7h8i9', Session::getId());
}
示例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');
}
示例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());
}
示例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());
}