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


PHP Request::cookie方法代碼示例

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


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

示例1: getExceptionData

 private function getExceptionData($exception)
 {
     $data = [];
     $data['host'] = Request::server('HTTP_HOST');
     $data['method'] = Request::method();
     $data['fullUrl'] = Request::fullUrl();
     if (php_sapi_name() === 'cli') {
         $data['host'] = parse_url(config('app.url'), PHP_URL_HOST);
         $data['method'] = 'CLI';
     }
     $data['exception'] = $exception->getMessage();
     $data['error'] = $exception->getTraceAsString();
     $data['line'] = $exception->getLine();
     $data['file'] = $exception->getFile();
     $data['class'] = get_class($exception);
     $data['storage'] = array('SERVER' => Request::server(), 'GET' => Request::query(), 'POST' => $_POST, 'FILE' => Request::file(), 'OLD' => Request::hasSession() ? Request::old() : [], 'COOKIE' => Request::cookie(), 'SESSION' => Request::hasSession() ? Session::all() : [], 'HEADERS' => Request::header());
     $data['storage'] = array_filter($data['storage']);
     $count = $this->config['count'];
     $data['exegutor'] = [];
     $data['file_lines'] = [];
     $file = new SplFileObject($data['file']);
     for ($i = -1 * abs($count); $i <= abs($count); $i++) {
         list($line, $exegutorLine) = $this->getLineInfo($file, $data['line'], $i);
         $data['exegutor'][] = $exegutorLine;
         $data['file_lines'][$data['line'] + $i] = $line;
     }
     // to make Symfony exception more readable
     if ($data['class'] == 'Symfony\\Component\\Debug\\Exception\\FatalErrorException') {
         preg_match("~^(.+)' in ~", $data['exception'], $matches);
         if (isset($matches[1])) {
             $data['exception'] = $matches[1];
         }
     }
     return $data;
 }
開發者ID:Cherry-Pie,項目名稱:LogEnvelope,代碼行數:35,代碼來源:LogEnvelope.php

示例2: composeTheme

 private function composeTheme()
 {
     view()->composer(['_layout', '_shared._new_products', 'account'], function ($view) {
         $theme = 0 == Request::cookie('theme') ? 'blue' : 'pink';
         $view->with('theme', $theme);
     });
 }
開發者ID:nakedwarrior,項目名稱:larashop,代碼行數:7,代碼來源:ViewComposerServiceProvider.php

示例3: anyIndex

 public function anyIndex()
 {
     //獲取路由傳入的參數
     //echo Route::input('name');
     //獲取配置信息
     $value = config('app.timezone');
     //var_dump($value);
     //獲取請求輸入  http://host-8/web/user?name=dfse  輸出:dfse
     $name1 = Request::has('name') ? Request::get('name') : '';
     //取得特定輸入數據,若沒有則取得默認值
     $name2 = Request::input('name', '默認值');
     $input = Request::all();
     //所有的
     $input = Request::input('products.0.name');
     //重定向
     //return redirect('login');
     //獲取cookie
     $value = Request::cookie('name');
     //獲取域名
     $url = Request::root();
     //		echo $url;
     $data = ['url' => $url, 'name1' => $name1, 'name2' => $name2, 'value' => $value];
     //響應視圖   響應最常用的幾個方法:make/view/json/download/redirectTo
     return response()->view('user.user', $data);
 }
開發者ID:breeze323136,項目名稱:laravel,代碼行數:25,代碼來源:UserController.php

示例4: checkLaravelCookie

 private static function checkLaravelCookie()
 {
     $cv = Request::cookie('laravel-remember');
     \Debugbar::error("laravel cookie: {$cv}");
     $uc = UserCookie::where('cookie', '=', $cv)->get()->first();
     if ($uc != null) {
         $user = User::where('id', '=', $uc->user_id)->get()->first();
         Auth::login($user);
     }
 }
開發者ID:mj1618,項目名稱:punto-cms,代碼行數:10,代碼來源:AdminLogin.php

示例5: get

 function get()
 {
     $url = '/';
     Auth::logout();
     UserCookie::where('cookie', '=', Request::cookie('laravel-remember'))->delete();
     if (Config::get('punto-cms.c2go-login') === true) {
         $url = 'https://sso.communitytogo.com.au/logout';
         if (Config::get('punto-cms.c2go-redirect-logout') !== null) {
             $url = Config::get('punto-cms.c2go-redirect-logout');
         }
     }
     return Redirect::to($url)->withCookie(Cookie::forget('remember'))->withCookie(Cookie::forget('laravel-remember'));
 }
開發者ID:mj1618,項目名稱:punto-cms,代碼行數:13,代碼來源:Logout.php


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