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


PHP Profile::getIp方法代码示例

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


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

示例1: write

 /**
  * {@inheritdoc}
  */
 public function write(Profile $profile)
 {
     $this->cleanup();
     $record = array('_id' => $profile->getToken(), 'parent' => $profile->getParentToken(), 'data' => base64_encode(serialize($profile->getCollectors())), 'ip' => $profile->getIp(), 'method' => $profile->getMethod(), 'url' => $profile->getUrl(), 'time' => $profile->getTime());
     return $this->getMongo()->update(array('_id' => $profile->getToken()), array_filter($record, function ($v) {
         return !empty($v);
     }), array('upsert' => true));
 }
开发者ID:netvlies,项目名称:symfony,代码行数:11,代码来源:MongoDbProfilerStorage.php

示例2: write

 /**
  * Write data associated with the given token.
  *
  * @param Profile $profile A Profile instance
  *
  * @return Boolean Write operation successful
  */
 public function write(Profile $profile)
 {
     $this->cleanup();
     $record = array('_id' => $profile->getToken(), 'parent' => $profile->getParent() ? $profile->getParent()->getToken() : null, 'data' => serialize($profile->getCollectors()), 'ip' => $profile->getIp(), 'url' => $profile->getUrl(), 'time' => $profile->getTime());
     return $this->getMongo()->insert(array_filter($record, function ($v) {
         return !empty($v);
     }));
 }
开发者ID:novaki,项目名称:symfony,代码行数:15,代码来源:MongoDbProfilerStorage.php

示例3: write

 /**
  * {@inheritdoc}
  */
 public function write(Profile $profile)
 {
     $db = $this->initDb();
     $args = array(':token' => $profile->getToken(), ':parent' => $profile->getParentToken(), ':data' => base64_encode(serialize($profile->getCollectors())), ':ip' => $profile->getIp(), ':method' => $profile->getMethod(), ':url' => $profile->getUrl(), ':time' => $profile->getTime(), ':created_at' => time());
     try {
         if ($this->has($profile->getToken())) {
             $this->exec($db, 'UPDATE sf_profiler_data SET parent = :parent, data = :data, ip = :ip, method = :method, url = :url, time = :time, created_at = :created_at WHERE token = :token', $args);
         } else {
             $this->exec($db, 'INSERT INTO sf_profiler_data (token, parent, data, ip, method, url, time, created_at) VALUES (:token, :parent, :data, :ip, :method, :url, :time, :created_at)', $args);
         }
         $this->cleanup();
         $status = true;
     } catch (\Exception $e) {
         $status = false;
     }
     $this->close($db);
     return $status;
 }
开发者ID:kchhainarong,项目名称:chantuchP,代码行数:21,代码来源:PdoProfilerStorage.php

示例4: write

 /**
  * {@inheritdoc}
  */
 public function write(Profile $profile)
 {
     $file = $this->getFilename($profile->getToken());
     $profileIndexed = is_file($file);
     if (!$profileIndexed) {
         // Create directory
         $dir = dirname($file);
         if (!is_dir($dir)) {
             mkdir($dir, 0777, true);
         }
     }
     // Store profile
     $data = array('token' => $profile->getToken(), 'parent' => $profile->getParentToken(), 'children' => array_map(function ($p) {
         return $p->getToken();
     }, $profile->getChildren()), 'data' => $profile->getCollectors(), 'ip' => $profile->getIp(), 'method' => $profile->getMethod(), 'url' => $profile->getUrl(), 'time' => $profile->getTime());
     if (false === file_put_contents($file, serialize($data))) {
         return false;
     }
     if (!$profileIndexed) {
         // Add to index
         if (false === ($file = fopen($this->getIndexFilename(), 'a'))) {
             return false;
         }
         fputcsv($file, array($profile->getToken(), $profile->getIp(), $profile->getMethod(), $profile->getUrl(), $profile->getTime(), $profile->getParentToken()));
         fclose($file);
     }
     return true;
 }
开发者ID:keneanung,项目名称:gw2spidy,代码行数:31,代码来源:FileProfilerStorage.php

示例5: write

 /**
  * {@inheritdoc}
  */
 public function write(Profile $profile)
 {
     $data = array('token' => $profile->getToken(), 'parent' => $profile->getParentToken(), 'children' => array_map(function ($p) {
         return $p->getToken();
     }, $profile->getChildren()), 'data' => $profile->getCollectors(), 'ip' => $profile->getIp(), 'method' => $profile->getMethod(), 'url' => $profile->getUrl(), 'time' => $profile->getTime());
     $profileIndexed = false !== $this->getValue($this->getItemName($profile->getToken()));
     if ($this->setValue($this->getItemName($profile->getToken()), $data, $this->lifetime)) {
         if (!$profileIndexed) {
             // Add to index
             $indexName = $this->getIndexName();
             $indexRow = implode("\t", array($profile->getToken(), $profile->getIp(), $profile->getMethod(), $profile->getUrl(), $profile->getTime(), $profile->getParentToken(), $profile->getStatusCode())) . "\n";
             return $this->appendValue($indexName, $indexRow, $this->lifetime);
         }
         return true;
     }
     return false;
 }
开发者ID:scrobot,项目名称:Lumen,代码行数:20,代码来源:BaseMemcacheProfilerStorage.php

示例6: write

 /**
  * Write data associated with the given token.
  *
  * @param Profile $profile A Profile instance
  *
  * @return Boolean Write operation successful
  */
 public function write(Profile $profile)
 {
     return $this->getMongo()->insert(array('token' => $profile->getToken(), 'ip' => $profile->getIp(), 'url' => $profile->getUrl() === null ? '' : $profile->getUrl(), 'profile' => serialize($profile)));
 }
开发者ID:nizam-uddin,项目名称:symfony,代码行数:11,代码来源:MongoDbProfilerStorage.php


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