本文整理汇总了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;
}
示例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);
});
}
示例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);
}
示例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);
}
}
示例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'));
}