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


PHP Session::save方法代码示例

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


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

示例1: check_login

 public function check_login()
 {
     $throttles = in_array(ThrottlesLogin::class, class_uses_recursive(get_class($this)));
     $rules = ['password' => 'required|max:64', 'email' => 'required|max:320|email'];
     $custom_msg = ['password.required' => 'You have to fill the password form.', 'password.max' => 'Your maximum password length is 64.', 'email.required' => 'You have to fill the email form.', 'email.max' => 'Your maximum password length is 320.', 'email.email' => 'This id not a valid email.'];
     $validator = Validator::make(Input::all(), $rules, $custom_msg);
     if ($validator->fails()) {
         Session::flash('errors', $validator->messages()->all());
         return view('auth.login');
     } else {
         $password = Input::get('password');
         $email = Input::get('email');
         //$remember = (Auth::viaRemember()) ? true : false;
         if (Auth::attempt(['email' => $email, 'password' => $password])) {
             // || Auth::viaRemember()
             Auth::login(Auth::user(), true);
             Session::flash('messages', ["Successfully logged with email {$email}."]);
             Session::save();
             return view('front.qbd');
         } else {
             Session::flash('errors', ["Authentification failed. Please check your credentials"]);
             return view('auth.login');
         }
     }
 }
开发者ID:SaadQobaa,项目名称:testing_laravel,代码行数:25,代码来源:LoginController.php

示例2: run

 /**
  * Run the application and save headers.
  * The response is up to WordPress
  *
  * @param  \Symfony\Component\HttpFoundation\Request $request
  * @return void
  */
 public function run(SymfonyRequest $request = null)
 {
     /**
      * On testing environment the WordPress helpers
      * will not have context. So we stop here.
      */
     if (defined('WELOQUENT_TEST_ENV') && WELOQUENT_TEST_ENV) {
         return;
     }
     $request = $request ?: $this['request'];
     $response = with($stack = $this->getStackedClient())->handle($request);
     // just set headers, but the content
     if (!is_admin()) {
         $response->sendHeaders();
     }
     if ('cli' !== PHP_SAPI) {
         $response::closeOutputBuffers(0, false);
     }
     /**
      * Save the session data until the application dies
      */
     add_action('wp_footer', function () use($stack, $request, $response) {
         $stack->terminate($request, $response);
         Session::save('wp_footer');
     });
 }
开发者ID:bruno-barros,项目名称:w.eloquent-framework,代码行数:33,代码来源:Application.php

示例3: checkCookie

 private function checkCookie()
 {
     if (request()->cookie('rem_token')) {
         $user = LaravelUsers::where('remember_token', request()->cookie('rem_token'))->first();
         if ($user) {
             Session::set('username', $user->username);
             Session::set('has_access', true);
             Session::save();
         }
     }
 }
开发者ID:swapster,项目名称:leti_eng,代码行数:11,代码来源:SessionAuthController.php

示例4: verifyUser

 public function verifyUser()
 {
     $data = Input::all();
     $status = Auth::attempt(['userid' => $data['userid'], 'password' => $data['password']]);
     $user = Auth::user();
     Session::save();
     return view('myaccount')->with('user', $user);
     // if($status)
     //    return view('home');
     // else
     //    echo "Wrong Credentials";
 }
开发者ID:praneeth531,项目名称:aspmgmt,代码行数:12,代码来源:LoginController.php

示例5: anyLogout

 public function anyLogout()
 {
     $callback = Request::input('callback');
     $uid = Session::get('uid');
     Session::flush();
     Session::save();
     $domain = $this->authModel->authorized_app_domain($uid);
     $app = '';
     if (is_array($domain)) {
         $app = implode('|', $domain);
     }
     $data['app'] = $app;
     $data['landing'] = $callback;
     return view('api.sso.logout', $data);
 }
开发者ID:xxtime,项目名称:boss,代码行数:15,代码来源:SsoController.php

示例6: postPayment

 public function postPayment(Request $request)
 {
     $quantity = $request->get('quantity');
     $payer = new Payer();
     $payer->setPaymentMethod('paypal');
     $item_1 = new Item();
     $item_1->setName(trans('store.paypal.item_name1') . env('PAYPAL_POINTS_PER_DOLLAR', 1000) . trans('store.paypal.item_name2'))->setCurrency('USD')->setQuantity($quantity)->setPrice('1');
     // unit price
     // add item to list
     $item_list = new ItemList();
     $item_list->setItems([$item_1]);
     $amount = new Amount();
     $amount->setCurrency('USD')->setTotal($quantity);
     $transaction = new Transaction();
     $transaction->setAmount($amount)->setItemList($item_list)->setDescription('Your transaction description');
     $redirect_urls = new RedirectUrls();
     $redirect_urls->setReturnUrl(URL::route('payment.status'))->setCancelUrl(URL::route('payment.status'));
     $payment = new Payment();
     $payment->setIntent('Sale')->setPayer($payer)->setRedirectUrls($redirect_urls)->setTransactions([$transaction]);
     try {
         $payment->create($this->_api_context);
     } catch (\PayPal\Exception\PPConnectionException $ex) {
         if (\Config::get('app.debug')) {
             echo 'Exception: ' . $ex->getMessage() . PHP_EOL;
             $err_data = json_decode($ex->getData(), true);
             exit;
         } else {
             die('Some error occur, sorry for inconvenient');
         }
     }
     foreach ($payment->getLinks() as $link) {
         if ($link->getRel() == 'approval_url') {
             $redirect_url = $link->getHref();
             break;
         }
     }
     // add payment ID to session
     Session::put('paypal_payment_id', $payment->getId());
     Session::save();
     if (isset($redirect_url)) {
         // redirect to paypal
         return Redirect::away($redirect_url);
     }
     return Redirect::route('original.route')->with('error', 'Unknown error occurred');
 }
开发者ID:softsolution,项目名称:antVel,代码行数:45,代码来源:PaypalController.php

示例7: resource

 private function resource($uid = 0)
 {
     $data = array('uid' => $uid, 'app_id' => env('APP_ID'), 'time' => time());
     ksort($data);
     $string = '';
     foreach ($data as $key => $value) {
         $string .= "{$key}={$value}&";
     }
     $string = rtrim($string, '&');
     $string .= env('SECRET_KEY');
     $data['sign'] = md5($string);
     $url = env('SSO_RESOURCE') . '?' . http_build_query($data);
     $response = file_get_contents($url);
     $result = json_decode($response, true);
     if ($result['code'] == 0) {
         Session::put('env.resource_all', $result['data']['resource_all']);
         Session::put('env.resource_tree', $result['data']['resource_tree']);
         Session::put('env.resource_uri', $result['data']['resource_uri']);
         Session::put('env.auth', $result['data']['auth']);
         Session::save();
     } else {
         return response()->json(array('code' => 1, 'msg' => $result['msg']));
     }
 }
开发者ID:xxtime,项目名称:boss,代码行数:24,代码来源:PublicController.php

示例8: fromGuestToUser

 /**
  * fromGuestToUser
  * This method is able to transfer all the guest shopping cart user to an user cart order.
  * It happens when a guest user has a shopping cart and press in checkout button.
  * @param  [object] $ordersController. Order controller object, which is passed through Authentication middleware.
  */
 public static function fromGuestToUser($ordersController)
 {
     /**
      * $cart_content contains the guest shopping cart information
      * @var [array]
      */
     $cart_content = Session::get('user.cart_content');
     //dd($cart_content, Session::get('user.cart'));
     foreach (Session::get('user.cart_content') as $product => $value) {
         $ordersController->addToOrder('cart', $product, new Request(['quantity' => $cart_content[$product] != '' ? $cart_content[$product] : 1, 'guestToUser' => 1]));
     }
     Session::forget('user.cart');
     Session::forget('user.cart_content');
     Session::save();
 }
开发者ID:rolka,项目名称:antVel,代码行数:21,代码来源:OrdersController.php

示例9: accountVerification

 /**
  * accountVerification allows users account verification.
  *
  * @param [string] $token is the var sent to users email to validate if the account belongs to him or not.
  */
 public function accountVerification($token)
 {
     //validating if the token retrieved is valid
     $user = User::select(['id'])->where('confirmation_code', 'LIKE', $token)->first();
     if ($user) {
         $name = $user->name . ' ' . $user->last_name;
         Session::put('message', str_replace('[name]', $name, trans('user.account_verified_ok_message')));
     } else {
         Session::put('messageClass', 'alert alert-danger');
         Session::put('message', trans('user.account_verified_error_message'));
     }
     Session::save();
     return redirect('/');
 }
开发者ID:ant-vel,项目名称:Web,代码行数:19,代码来源:UsersController.php

示例10: doLogin

 public function doLogin(Request $request)
 {
     if (!$request->has('email')) {
         echo '{"success":false,"msg":"Please fill in your Email!"}';
         exit;
     }
     $email = strtolower($request->input('email'));
     if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
         echo '{"success":false,"msg":"Your Email address format is incorrect! Please try again!"}';
         exit;
     }
     if (!$request->has('password')) {
         echo '{"success":false,"msg":"Please enter your Password!"}';
         exit;
     } else {
         $password = md5($request->input('password'));
     }
     $row = DB::select("select * from members where email = '{$email}' and password = '{$password}'");
     if (sizeof($row) == 1) {
         if ($row[0]->status == "Active") {
             $fName = explode(" ", $row[0]->name)[0];
             $request->session()->put('memberID', $row[0]->id);
             $request->session()->put('memberName', $fName);
             $request->session()->put('member', $row[0]->email);
             $request->session()->put('memberCardID', $row[0]->memberCardID);
             Session::save();
             $response = new Response();
             $shoppingCartItemsFromCookie = json_decode($request->cookie('shoppingCart'), true);
             if ($shoppingCartItemsFromCookie != null) {
                 $shoppingCartItemsFromDB = DB::select("select * from shopping_cart where member_id = '{$email}'");
                 $shoppingCartItemsFromDB = json_decode($shoppingCartItemsFromDB[0]->shopping_cart, true);
                 foreach ($shoppingCartItemsFromCookie as $product_id => $amount) {
                     if (array_key_exists($product_id, $shoppingCartItemsFromDB)) {
                         $maxStock = DB::select("select * from products where product_id = '{$product_id}'");
                         $newAmount = $shoppingCartItemsFromDB[$product_id] + $amount;
                         if ($newAmount > $maxStock[0]->stock) {
                             $newAmount = $maxStock[0]->stock;
                         }
                         $shoppingCartItemsFromDB[$product_id] = $newAmount;
                     } else {
                         $shoppingCartItemsFromDB[$product_id] = $amount;
                     }
                     unset($shoppingCartItemsFromCookie[$product_id]);
                 }
                 $shoppingCartItemsFromDB = json_encode($shoppingCartItemsFromDB);
                 DB::table('shopping_cart')->where('member_id', $email)->update(['shopping_cart' => $shoppingCartItemsFromDB]);
                 return response('{"success":true}')->withCookie(cookie('shoppingCart', json_encode($shoppingCartItemsFromCookie)));
             } else {
                 return '{"success":true}';
             }
         } elseif ($row[0]->status == "Disable") {
             echo '{"success":false,"msg":"Your account has been disabled, Please contact the administrator!"}';
             exit;
         } else {
             echo '{"success":false,"msg":"Your account has not been activated, Please check your email and activate your account."}';
             exit;
         }
     } else {
         echo '{"success":false,"msg":"Your email or password is incorrect, please try again!"}';
         exit;
     }
 }
开发者ID:ianliu2015,项目名称:DocsLiquor,代码行数:62,代码来源:RegisterLoginController.php

示例11: getRegCode

 public function getRegCode(Request $request)
 {
     if (Session::has('mobile_code')) {
         if (time() - Session::get('mobile_code_time') < 30) {
             return 999;
         }
     }
     /*  $yunpianSms = new YunPianSms();
             $helper = new Helper();
             $random_code = $helper->mt_rand_str(6, '0123456789');
             $response = $yunpianSms->sendMsg($mobile, '【最惠购】您的验证码是' . $random_code . '。有效期为5分钟,请尽快验证');
     
             */
     $mobile = $request->get('mobile');
     $apikey = "b2e2c4a661a0cf7e1d80f7bb167d142f";
     //请用自己的apikey代替
     $helper = new Helper();
     $random_code = $helper->mt_rand_str(6, '0123456789');
     $tpl_value = "#company#=最惠购&#code#=" . $random_code;
     // $text='【最惠购】您的验证码是' . $random_code . '。有效期为5分钟,请尽快验证';
     // Session::flash('regcode', $random_code);
     $tpl_id = 1;
     $response = json_decode($this->tpl_send_sms($apikey, $tpl_id, $tpl_value, $mobile))->data->code;
     //Log::error('Something is really going wrong.');
     //  $result = json_decode($response)->data->code;
     //   if ($result == 0)
     //   {
     Session::put('mobile_code', $random_code);
     Session::put('mobile_code_time', time());
     //   }
     Session::save();
     return $response;
 }
开发者ID:jiangyukun,项目名称:jingou,代码行数:33,代码来源:AuthorityController.php

示例12: setPaymentData

 /**
  * Set payment data.
  *
  * @param  array  $parameters
  *
  * @return void
  */
 protected function setPaymentData(array $parameters)
 {
     Session::put('payment', $parameters);
     Session::save();
 }
开发者ID:shopalicious,项目名称:payment,代码行数:12,代码来源:Gateway.php

示例13: resetHaystack

 public function resetHaystack()
 {
     Session::forget('suggest-listed');
     Session::save();
 }
开发者ID:rolka,项目名称:antVel,代码行数:5,代码来源:productsHelper.php

示例14: save

 /**
  * Save the data, if necessary.    This would be a no-op when using the
  * $_SESSION implementation, but could be used for saving to file or
  * database as an action instead of on every set.
  *
  * @return null
  */
 public function save()
 {
     Session::save();
 }
开发者ID:parziphal,项目名称:parse,代码行数:11,代码来源:SessionStorage.php

示例15: setSidAttribute

 public function setSidAttribute($value)
 {
     $this->attributes['sid'] = $value;
     Session::put('visitor_log_sid', $value);
     Session::save();
 }
开发者ID:sourcequartet,项目名称:visitor-log,代码行数:6,代码来源:VisitorModel.php


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