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


PHP Request::server方法代码示例

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


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

示例1: match

 public function match($store)
 {
     if ($store_id = Request::server('LAVENDER_STORE')) {
         return $store->find($store_id);
     }
     return false;
 }
开发者ID:BryceHappy,项目名称:lavender,代码行数:7,代码来源:EnvMatch.php

示例2: setupLayout

 protected function setupLayout()
 {
     $is_rapyd = Request::server('HTTP_HOST') == "www.rapyd.com" ? true : false;
     View::composer('rapyd::demo.*', function ($view) use($is_rapyd) {
         $view->with('is_rapyd', $is_rapyd);
     });
 }
开发者ID:procesorrr,项目名称:ServProgramator,代码行数:7,代码来源:DemoController.php

示例3: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->app['router']->before(function ($request) {
         // First clear out all "old" visitors
         Visitor::clear();
         $page = Request::path();
         $ignore = Config::get('visitor-log::ignore');
         if (is_array($ignore) && in_array($page, $ignore)) {
             //We ignore this site
             return;
         }
         $visitor = Visitor::getCurrent();
         if (!$visitor) {
             //We need to add a new user
             $visitor = new Visitor();
             $visitor->ip = Request::getClientIp();
             $visitor->useragent = Request::server('HTTP_USER_AGENT');
             $visitor->sid = str_random(25);
         }
         $user = null;
         $usermodel = strtolower(Config::get('visitor-log::usermodel'));
         if (($usermodel == "auth" || $usermodel == "laravel") && Auth::check()) {
             $user = Auth::user()->id;
         }
         if ($usermodel == "sentry" && class_exists('Cartalyst\\Sentry\\SentryServiceProvider') && Sentry::check()) {
             $user = Sentry::getUser()->id;
         }
         //Save/Update the rest
         $visitor->user = $user;
         $visitor->page = $page;
         $visitor->save();
     });
 }
开发者ID:uniacid,项目名称:visitor-log,代码行数:38,代码来源:VisitorLogServiceProvider.php

示例4: 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

示例5: getSupportedByClient

 /**
  * Get locales supported by client (from HTTP header)
  * @return array Supported locales
  */
 private function getSupportedByClient()
 {
     $supportedByClient = explode(',', Request::server('HTTP_ACCEPT_LANGUAGE'));
     array_walk($supportedByClient, function ($val) {
         return substr($val, 0, 2);
     });
     return $supportedByClient;
 }
开发者ID:simondubois,项目名称:budget,代码行数:12,代码来源:AppServiceProvider.php

示例6: boot

 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     $events->listen('auth.login', function ($user, $remember) {
         // Record user login
         Activity::create(['subject_type' => 'User', 'subject_id' => '', 'event' => 'Logged In', 'user_id' => $user->id, 'ip' => Request::server('REMOTE_ADDR')]);
     });
 }
开发者ID:1stel,项目名称:stratostack-portal,代码行数:14,代码来源:EventServiceProvider.php

示例7: match

 public function match($store)
 {
     return $store->whereHas('config', function ($q) {
         $hostname = Request::server('SERVER_NAME');
         $q->where('key', '=', 'url');
         $q->where('value', '=', $hostname);
     })->first();
 }
开发者ID:BryceHappy,项目名称:lavender,代码行数:8,代码来源:DomainMatch.php

示例8: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($request->input('number') < 100) {
         $server = Request::server();
         //            return Response::json($server);
     }
     return $next($request);
 }
开发者ID:share0307,项目名称:larave5_study,代码行数:15,代码来源:TestMiddleware.php

示例9: edit

 public function edit(Sample $sample)
 {
     $iSet = IndexSet::lists('name', 'id');
     $iAll = IndexSet::all();
     $pg = ProjectGroup::lists('name', 'id');
     // Set the page where edit came from
     session(['edit_sample_url' => Request::server('HTTP_REFERER')]);
     return view('samples.edit', ['iSet' => $iSet, 'iAll' => $iAll, 'pg' => $pg, 'sample' => $sample]);
 }
开发者ID:famorted,项目名称:seqtrack,代码行数:9,代码来源:SamplesController.php

示例10: GetUserIP

 public function GetUserIP()
 {
     if (!$this->getUrlData()) {
         return Response::json(array('success' => false, 'result' => $this->errmsg), 400);
     } else {
         //return a response in json
         return Response::json(array('success' => true, 'user_ip' => Request::server('REMOTE_ADDR')), 200);
     }
 }
开发者ID:whoisdoma,项目名称:core,代码行数:9,代码来源:IPWhoisController.php

示例11: match

 public function match($store)
 {
     $hostname = Request::server('SERVER_NAME');
     $host = explode('.', $hostname);
     if (isset($host[count($host) - 3])) {
         $subdomain = $host[count($host) - 3];
         return $store->whereHas('config', function ($q) use($subdomain) {
             $q->where('key', '=', 'subdomain');
             $q->where('value', '=', $subdomain);
         })->first();
     }
     return false;
 }
开发者ID:BryceHappy,项目名称:lavender,代码行数:13,代码来源:SubdomainMatch.php

示例12: boot

 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     $url = explode('.', Request::server('HTTP_HOST'));
     $subdomain = $url[0];
     Session::put('sub', $subdomain);
     view()->composer(['admin.parts.header', 'admin.partials.models.add_task', 'admin.pages.my_dashboard'], function ($view) {
         $view->with('user', User::where('id', Auth::user()->id)->with('leads')->first())->with('task_names', TaskName::groupBy('task_name')->get());
     });
     view()->composer('admin.parts.user_notifications', function ($view) {
         $view->with('userTasks', Task::userAllNonCompletedTasks());
     });
     view()->composer('admin.leads.parts.reassign_lead', function ($view) {
         $view->with('users', User::all());
     });
 }
开发者ID:jdelise,项目名称:career_site,代码行数:20,代码来源:AppServiceProvider.php

示例13: __construct

 public function __construct($slug, $params)
 {
     if ($slug && $params) {
         $result = EmailsTemplate::where("slug", $slug)->first();
         foreach ($params as $k => $el) {
             $search[] = "{" . $k . "}";
             $replace[] = $el;
         }
         $search[] = "{domen}";
         $replace[] = $_SERVER['HTTP_HOST'];
         if ($result->id) {
             $this->subject = $result->subject;
             $this->body = $result->body;
             $this->body = str_replace('/images/', 'http://' . Request::server("HTTP_HOST") . "/images/", $this->body);
             $this->body = str_replace($search, $replace, $this->body);
             $this->subject = str_replace($search, $replace, $this->subject);
         }
     }
 }
开发者ID:arturishe21,项目名称:mail-templates,代码行数:19,代码来源:MailT.php

示例14: transformMessage

 public function transformMessage(\CarMessage $message, $redundantly = false)
 {
     $content = [];
     $resp = ['message_id' => $message->id, 'chat_id' => $message->chat_id, 'timestamp' => $message->created_at, 'delivered_at' => $message->delivered_at, 'viewed_at' => $message->viewed_at];
     if (!is_null($message->text)) {
         $content['text'] = $message->text;
     }
     if (!is_null($message->long)) {
         $content['geo'] = ['lat' => $message->lat, 'long' => $message->long, 'location' => $message->location];
     }
     if (!is_null($message->image_id)) {
         $domain = 'http' . (Request::server('HTTPS') ? '' : 's') . '://' . Request::server('HTTP_HOST');
         $content['image'] = ['id' => $message->attachmentImage->id, 'thumb' => "{$domain}/api/carchats/{$message->chat_id}/attachments/{$message->attachmentImage->id}", 'origin' => "{$domain}/api/carchats/{$message->chat_id}/attachments/{$message->attachmentImage->id}/origin", 'width' => $message->attachmentImage->width, 'height' => $message->attachmentImage->height];
     }
     if (!is_null($message->car_id)) {
         $content['car'] = ['id' => $message->attachmentCar->id, 'mark' => $message->attachmentCar->mark, 'model' => $message->attachmentCar->model, 'year' => $message->attachmentCar->year, 'color' => $message->attachmentCar->color, 'vehicle_type' => $message->attachmentCar->vehicle_type, 'body_type' => $message->attachmentCar->body_type];
         if (!is_null($message->car_number)) {
             $content['car']['number'] = $message->car_number;
         }
     }
     if ($redundantly) {
         if (!$message->via_car) {
             $user = User::find($message->user_id);
             $resp['user'] = ['id' => $user->id, 'name' => $user->name, 'img' => ['middle' => $user->img_middle]];
         } else {
             $chat = CarChat::find($message->chat_id);
             $resp['car'] = ['id' => $message->user_car_id, 'number' => $chat->number];
         }
     } else {
         if ($message->via_car) {
             $resp['car_id'] = $message->user_car_id;
         } else {
             $resp['user_id'] = $message->user_id;
         }
     }
     $resp['content'] = $content;
     if ($message->isUnread()) {
         $resp['unread'] = true;
     }
     //		dd($resp);
     return $resp;
 }
开发者ID:SenhorBardell,项目名称:yol,代码行数:42,代码来源:chatsCollectionTransformer.php

示例15: onViewLoad

 public function onViewLoad($route)
 {
     $data = [];
     $routeAction = $route->getAction();
     if (Auth::check()) {
         $request = App::make(Request::class);
         $this->mixPanel->identify(Auth::user()->id);
         $this->mixPanel->people->set(Auth::user()->id, [], $request->ip());
     }
     if (CurrentRequest::url()) {
         $data['Url'] = CurrentRequest::url();
     }
     if (is_array($routeAction) && array_key_exists('as', $routeAction)) {
         $data['Route'] = $routeAction['as'];
     }
     if (CurrentRequest::server('HTTP_REFERER')) {
         $data['Referrer'] = CurrentRequest::server('HTTP_REFERER');
     }
     $this->mixPanel->track('Page View', $data);
 }
开发者ID:janusnic,项目名称:MixPanel,代码行数:20,代码来源:MixPanelEventHandler.php


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