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


PHP Request::server方法代码示例

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


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

示例1: setIp

 public function setIp()
 {
     $ipKey = ServerModel::firstOrNew(array('key' => 'ip'));
     $ipKey->value = Request::server('REMOTE_ADDR');
     $ipKey->save();
     return $ipKey->value;
 }
开发者ID:seccijr,项目名称:pablohart,代码行数:7,代码来源:ServerController.php

示例2: __construct

 /**
  * Create a new job instance.
  *
  * @return void
  */
 public function __construct($keywords)
 {
     $this->username = \Request::server('PHP_AUTH_USER', 'sampleuser');
     $keywords = strip_tags(str_replace("'", " ", $keywords));
     $keywords = strtolower($keywords);
     $this->keywords = $keywords;
 }
开发者ID:kirtromero,项目名称:cw_members,代码行数:12,代码来源:UpdateSearchKeywords.php

示例3: boot

 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $app = $this->app;
     $configPath = __DIR__ . '/../config/debugbar.php';
     $this->publishes([$configPath => $this->getConfigPath()], 'config');
     if ($app->runningInConsole()) {
         if (false === array_key_exists(1, \Request::server('argv')) || true === empty($artisanCommand = \Request::server('argv')[1]) || 'config:cache' !== $artisanCommand) {
             $this->app['config']->set('debugbar.enabled', false);
         }
     }
     $routeConfig = ['namespace' => 'Barryvdh\\Debugbar\\Controllers', 'prefix' => $this->app['config']->get('debugbar.route_prefix')];
     $this->getRouter()->group($routeConfig, function ($router) {
         $router->get('open', ['uses' => 'OpenHandlerController@handle', 'as' => 'debugbar.openhandler']);
         $router->get('clockwork/{id}', ['uses' => 'OpenHandlerController@clockwork', 'as' => 'debugbar.clockwork']);
         $router->get('assets/stylesheets', ['uses' => 'AssetController@css', 'as' => 'debugbar.assets.css']);
         $router->get('assets/javascript', ['uses' => 'AssetController@js', 'as' => 'debugbar.assets.js']);
     });
     $enabled = $this->app['config']->get('debugbar.enabled');
     // If enabled is null, set from the app.debug value
     if (is_null($enabled)) {
         $enabled = $this->checkAppDebug();
         $this->app['config']->set('debugbar.enabled', $enabled);
     }
     if (!$enabled) {
         return;
     }
     /** @var LaravelDebugbar $debugbar */
     $debugbar = $this->app['debugbar'];
     $debugbar->boot();
     $this->registerMiddleware('Barryvdh\\Debugbar\\Middleware\\Debugbar');
 }
开发者ID:JaapMoolenaar,项目名称:laravel-debugbar,代码行数:36,代码来源:ServiceProvider.php

示例4: contents

 public function contents($model_id = 0, $slug = '')
 {
     $network = $this->network;
     $theme = $network->theme;
     $theme = check_for_tour_theme($theme);
     Theme::setActive($theme);
     $data = $this->data;
     $model = Model::find($model_id);
     if ($model) {
         $contents = $model->contents()->published()->ofNetwork($this->network->id)->orderBy('id', 'desc')->get();
         $data['page_title'] = $model->name . ' Contents';
         $data['model'] = $model;
         $data['contents'] = $contents;
         $content_views = 0;
         foreach ($contents as $content) {
             $content_views = $content_views + $content->fake_views;
         }
         $data['content_views'] = $content_views;
         $username = \Request::server('PHP_AUTH_USER', 'sampleuser');
         $data['is_favorite'] = $username && Favorite::ofUsername($username)->hasFavorite('Model', $model->id)->count() ? 1 : 0;
         $this->breadcrumbs->addCrumb('Popular Models', url('models'));
         $this->breadcrumbs->addCrumb($model->name . ' Contents');
         return Theme::view('model.contents', $data);
     }
 }
开发者ID:kirtromero,项目名称:cw_members,代码行数:25,代码来源:ModelController.php

示例5: signPacket

 /**
  * Generates a signature for a packet request response
  *
  * @param array                  $packet
  * @param int|null               $code
  * @param string|\Exception|null $message
  *
  * @return array
  *
  */
 protected static function signPacket(array $packet, $code = null, $message = null)
 {
     $_ex = false;
     if ($code instanceof \Exception) {
         $_ex = $code;
         $code = null;
     } elseif ($message instanceof \Exception) {
         $_ex = $message;
         $message = null;
     }
     !$code && ($code = Response::HTTP_OK);
     $code = $code ?: ($_ex ? $_ex->getCode() : Response::HTTP_OK);
     $message = $message ?: ($_ex ? $_ex->getMessage() : null);
     $_startTime = \Request::server('REQUEST_TIME_FLOAT', \Request::server('REQUEST_TIME', $_timestamp = microtime(true)));
     $_elapsed = $_timestamp - $_startTime;
     $_id = sha1($_startTime . \Request::server('HTTP_HOST') . \Request::server('REMOTE_ADDR'));
     //  All packets have this
     $_packet = array_merge($packet, ['error' => false, 'status_code' => $code, 'request' => ['id' => $_id, 'version' => static::PACKET_VERSION, 'signature' => base64_encode(hash_hmac(config('dfe.signature-method'), $_id, $_id, true)), 'verb' => \Request::method(), 'request-uri' => \Request::getRequestUri(), 'start' => date('c', $_startTime), 'elapsed' => (double) number_format($_elapsed, 4)]]);
     //  Update the error entry if there was an error
     if (!array_get($packet, 'success', false) && !array_get($packet, 'error', false)) {
         $_packet['error'] = ['code' => $code, 'message' => $message, 'exception' => $_ex ? Json::encode($_ex) : false];
     } else {
         array_forget($_packet, 'error');
     }
     return $_packet;
 }
开发者ID:rajeshpillai,项目名称:dfe-common,代码行数:36,代码来源:BasePacket.php

示例6: testServerMethodReturnsFromServerArray

 /**
  * Test the Request::server method.
  *
  * @group laravel
  */
 public function testServerMethodReturnsFromServerArray()
 {
     $this->setServerVar('TEST', 'something');
     $this->setServerVar('USER', array('NAME' => 'taylor'));
     $this->assertEquals('something', Request::server('test'));
     $this->assertEquals('taylor', Request::server('user.name'));
 }
开发者ID:gilyaev,项目名称:framework-bench,代码行数:12,代码来源:request.test.php

示例7: add

 /**
  * @param $initial_hits
  * @param $exception_type
  * @return bool
  */
 public function add($initial_hits, $exception_type)
 {
     $res = false;
     try {
         $remote_address = Request::server('REMOTE_ADDR');
         //try to create on cache
         $this->cache_service->addSingleValue($remote_address, $initial_hits, intval($this->server_configuration_service->getConfigValue("BlacklistSecurityPolicy.BannedIpLifeTimeSeconds")));
         $this->tx_service->transaction(function () use($remote_address, $exception_type, $initial_hits, &$res) {
             $banned_ip = BannedIP::where("ip", "=", $remote_address)->first();
             if (!$banned_ip) {
                 $banned_ip = new BannedIP();
                 $banned_ip->ip = $remote_address;
             }
             $banned_ip->exception_type = $exception_type;
             $banned_ip->hits = $initial_hits;
             if (Auth::check()) {
                 $banned_ip->user_id = Auth::user()->getId();
             }
             $res = $banned_ip->Save();
         });
     } catch (Exception $ex) {
         $this->log_service->error($ex);
         $res = false;
     }
     return $res;
 }
开发者ID:smarcet,项目名称:openstackid,代码行数:31,代码来源:BannedIPService.php

示例8: postAdminAccount

 public function postAdminAccount()
 {
     $data = Input::all();
     //return View::make('install.done');
     try {
         $user = Sentry::createUser(array('email' => $data['email'], 'password' => $data['password'], 'activated' => true, 'first_name' => $data['first_name'], 'last_name' => $data['last_name']));
         $group = Sentry::findGroupByName('admin');
         $user->addGroup($group);
         $quicknote = new \Quicknote();
         $quicknote->user_id = $user->id;
         $quicknote->save();
         $userProfile = new \UserProfile();
         $userProfile->id = $user->id;
         $userProfile->save();
         $imageResult = App::make('AuthController')->{'createUserImage'}($user->id, $data['first_name'][0], $data['last_name'][0]);
         $installationDate = date('Y-m-d H:i:s');
         $installationHost = Request::server('PATH_INFO');
         $new92fiveConfig = new NewConfig();
         $new92fiveConfig->toFile(app_path() . '/config/92five.php', ['install' => true, 'version' => '1.0', 'installationDate' => $installationDate, 'installationHost' => $installationHost]);
         return View::make('install.done');
     } catch (Exception $e) {
         Log::error('Something Went Wrong in Install Controller Repository - addUserWithDetails():' . $e->getMessage());
         throw new Exception('Something Went Wrong in Install Controller Repository - addUserWithDetails()');
     }
 }
开发者ID:ymnl007,项目名称:92five,代码行数:25,代码来源:InstallController.php

示例9: getAsArray

 public function getAsArray($redundantly = false)
 {
     if (isset($this->id) && (int) $this->id > 0) {
         $content = array();
         if (!is_null($this->text)) {
             $content['text'] = $this->text;
         } else {
             if (!is_null($this->image_id)) {
                 $domain = 'http' . (Request::server('HTTPS') ? '' : 's') . '://' . Request::server('HTTP_HOST');
                 $attachment = MessageAttachment::find($this->image_id);
                 $content['image'] = array('id' => (int) $attachment->id, 'thumb' => $domain . '/api/messages/attach/thumb/' . $attachment->id, 'origin' => $domain . '/api/messages/attach/gallery/' . $attachment->id, 'width' => $attachment->width, 'height' => $attachment->height);
             } else {
                 if (!is_null($this->car_id)) {
                     $car = Car::withTrashed()->find($this->car_id);
                     $content['car'] = array('id' => (int) $car->id, 'mark' => (int) $car->mark, 'model' => (int) $car->model, 'year' => (int) $car->year, 'color' => (int) $car->color, 'vehicle_type' => (int) $car->vehicle_type, 'body_type' => (int) $car->body_type);
                     if (!is_null($this->car_number)) {
                         $content['car']['number'] = $this->car_number;
                     }
                 } else {
                     if (!is_null($this->lat)) {
                         $content['geo'] = array('lat' => (double) $this->lat, 'long' => (double) $this->lng, 'location' => $this->location);
                     }
                 }
             }
         }
         if ($redundantly) {
             $user = User::find($this->user_id);
             return array('message_id' => (int) $this->id, 'chat_id' => (int) $this->chat_id, 'user' => array('id' => (int) $user->id, 'name' => $user->name, 'img' => array('middle' => $user->img_middle)), 'content' => $content, 'timestamp' => $this->getTimestamp(), 'delivered_at' => $this->delivered_at, 'viewed_at' => $this->viewed_at);
         } else {
             return array('message_id' => (int) $this->id, 'chat_id' => (int) $this->chat_id, 'user_id' => (int) $this->user_id, 'content' => $content, 'timestamp' => $this->getTimestamp(), 'delivered_at' => $this->delivered_at, 'viewed_at' => $this->viewed_at);
         }
     }
     return array();
 }
开发者ID:SenhorBardell,项目名称:yol,代码行数:34,代码来源:Message.php

示例10: registerUniversity

 /**
  * Register University
  * 
  * @return View
  */
 public function registerUniversity()
 {
     if (!is_null(Input::get('g-recaptcha-response'))) {
         $recaptcha = new \ReCaptcha\ReCaptcha(Config::get('recaptcha.private_key'));
         $resp = $recaptcha->verify(Input::get('g-recaptcha-response'), Request::server('REMOTE_ADDR'));
         if ($resp->isSuccess()) {
             $user = new User();
             $user->user = trim(strtolower(Input::get('university_email')));
             $user->password = Hash::make(Input::get('university_password'));
             $user->rank = "university";
             $user->last_activity = null;
             try {
                 $user->save();
             } catch (MongoDuplicateKeyException $e) {
                 return Redirect::back()->withErrors(array('error' => Lang::get('register_university.email_duplicated')));
             }
             $user = User::first(['user' => $user->user]);
             $university = new University();
             $university->_id = $user->_id;
             $university->name = trim(Input::get('university_name'));
             $university->email = trim(strtolower(Input::get('university_email')));
             $university->acronym = strtoupper(trim(Input::get('university_acronym')));
             $university->profile_image = null;
             $university->save();
             return Redirect::to('/')->with('message', Lang::get('register_university.register_true'));
         } else {
             $errors = $resp->getErrorCodes();
             return Redirect::back()->withErrors(array('error' => Lang::get('register_student.message_captcha') . ' [' . $errors[0] . ']'));
         }
     } else {
         return Redirect::back()->withErrors(array('error' => Lang::get('register_student.message_captcha') . ' [ 99 ]'));
     }
 }
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:38,代码来源:UniversityController.php

示例11: __construct

 /**
  * Create a new job instance.
  *
  * @return void
  */
 public function __construct($id)
 {
     $this->content = Content::find($id);
     $this->username = \Request::server('PHP_AUTH_USER');
     $referer = \Request::server('HTTP_REFERER');
     $this->referrer = $referer ? $referer : '';
 }
开发者ID:kirtromero,项目名称:cw_members,代码行数:12,代码来源:UpdateViewCount.php

示例12: boot

 public function boot(Router $router)
 {
     $this->commands(Install::class);
     foreach ($this->routeMiddleware as $key => $middleware) {
         $router->middleware($key, $middleware);
     }
     $groupOptions = ['namespace' => $this->namespace];
     if (config('adminPanel.subDomain')) {
         $groupOptions['domain'] = config('adminPanel.routePrefix') . '.' . preg_replace("/^(.*?)\\.(.*)\$/", "\$2", \Request::server('SERVER_NAME'));
     } else {
         $groupOptions['prefix'] = config('adminPanel.routePrefix');
     }
     $router->group($groupOptions, function (Router $router) {
         $router->controller('auth', 'Auth\\AuthController', ['getRegister' => 'admin.register', 'getLogin' => 'admin.login', 'getLogout' => 'admin.logout']);
         $router->group(['middleware' => 'ap.permission', 'permission' => config('adminPanel.ap_permission')], function (Router $route) {
             $route->get('/', ['as' => 'admin.home', function () {
                 return view('adminPanel::hello');
             }]);
             $route->controller('ajax', 'AjaxController');
             $route->resource('user', 'UserController', ['as' => 'admin']);
             $route->model('role', config('entrust.role'));
             $route->resource('role', 'RoleController', ['as' => 'admin']);
             $route->model('permission', config('entrust.permission'));
             $route->resource('permission', 'PermissionController', ['as' => 'admin']);
         });
     });
     $this->loadViewsFrom(__DIR__ . '/../../resources/views', 'adminPanel');
     $this->publishes([__DIR__ . '/../../config/config.php' => config_path('adminPanel.php')], 'config');
     $this->publishes([__DIR__ . '/../../resources/assets' => base_path('resources/adminAssets')], 'assets');
     $this->publishes([__DIR__ . '/../../migrations' => base_path('database/migrations')], 'migrate');
 }
开发者ID:hramose,项目名称:Admin-Panel,代码行数:31,代码来源:AdminPanelServiceProvider.php

示例13: __construct

 public function __construct()
 {
     $this->userIp = class_exists('\\Illuminate\\Support\\Facades\\Request') ? \Request::getClientIp() : $_SERVER['REMOTE_ADDR'];
     $this->userAgent = class_exists('\\Illuminate\\Support\\Facades\\Request') ? \Request::server('HTTP_USER_AGENT') : $_SERVER['HTTP_USER_AGENT'];
     $this->referrer = class_exists('\\Illuminate\\Support\\Facades\\URL') ? \URL::previous() : $_SERVER['HTTP_REFERER'];
     $this->permalink = class_exists('\\Illuminate\\Support\\Facades\\Request') ? \Request::url() : $_SERVER['REQUEST_URI'];
 }
开发者ID:nickurt,项目名称:laravel-akismet,代码行数:7,代码来源:Akismet.php

示例14: addToPopularSearchImages

 public function addToPopularSearchImages($arrData)
 {
     //$query = Request::server('REQUEST_URI');
     $query = isset($arrData['query']) ? $arrData['query'] : "";
     $request_url = Request::server('REQUEST_URI') != "" && Request::server('REQUEST_URI') != "/" ? Request::server('REQUEST_URI') : $query;
     return PopularSearchImages::create(array('keyword' => trim($arrData['keyword']), 'image_id' => $arrData['image_id'], 'query' => $request_url));
 }
开发者ID:nguyendaivu,项目名称:imagestock,代码行数:7,代码来源:TypeImagesController.php

示例15: configureLocale

 /**
  * Detect and set application localization environment (language).
  * NOTE: Don't foreget to ADD/SET/UPDATE the locales array in app/config/app.php!
  *
  */
 private function configureLocale()
 {
     $mLocale = Config::get('app.locale');
     if (!Session::has('locale')) {
         $mFromCookie = Cookie::get('locale', null);
         if ($mFromCookie != null && in_array($mFromCookie, Config::get('app.locales'))) {
             $mLocale = $mFromCookie;
         } else {
             $mFromURI = Request::segment(1);
             if ($mFromURI != null && in_array($mFromURI, Config::get('app.locales'))) {
                 $mLocale = $mFromURI;
             } else {
                 $mFromBrowser = substr(Request::server('http_accept_language'), 0, 2);
                 if ($mFromBrowser != null && in_array($mFromBrowser, Config::get('app.locales'))) {
                     $mLocale = $mFromBrowser;
                 }
             }
         }
         Session::put('locale', $mLocale);
         Cookie::forever('locale', $mLocale);
     } else {
         $mLocale = Session::get('locale');
     }
     App::setLocale($mLocale);
 }
开发者ID:bizcoine,项目名称:ecoinstrader,代码行数:30,代码来源:BaseController.php


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