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


PHP String::uuid方法代码示例

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


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

示例1: key

 /**
  * Obtain the session key.
  *
  * For this adapter, it is a UUID based on the SERVER_ADDR variable.
  *
  * @return string UUID.
  */
 public static function key()
 {
     $context = function ($value) use(&$config) {
         return isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '127.0.0.1';
     };
     return String::uuid($context);
 }
开发者ID:EHER,项目名称:monopolis,代码行数:14,代码来源:Memory.php

示例2: __init

 public static function __init()
 {
     parent::__init();
     static::applyFilter('create', function ($self, $params, $chain) {
         if (empty($params['data']['id'])) {
             $params['data']['id'] = String::uuid();
         }
         return $chain->next($self, $params, $chain);
     });
 }
开发者ID:notomato,项目名称:li3_activitystreams,代码行数:10,代码来源:Base.php

示例3: testMultipleUuidGeneration

 /**
  * testMultipleUuidGeneration method
  *
  * @return void
  */
 public function testMultipleUuidGeneration()
 {
     $check = array();
     $count = 50;
     $pattern = "/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[8-9a-b][a-f0-9]{3}-[a-f0-9]{12}\$/";
     for ($i = 0; $i < $count; $i++) {
         $result = String::uuid();
         $match = preg_match($pattern, $result);
         $this->assertTrue($match);
         $this->assertFalse(in_array($result, $check));
         $check[] = $result;
     }
 }
开发者ID:newmight2015,项目名称:Blockchain-2,代码行数:18,代码来源:StringTest.php

示例4: testGeneratingUuidWithCallback

 /**
  * Tests generating a UUID with seed data provided by an anonymous function.
  *
  * @return void
  */
 public function testGeneratingUuidWithCallback()
 {
     $pattern = "/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}\$/";
     $result = String::uuid(function ($value) {
         if ($value == 'SERVER_ADDR') {
             return '::1';
         }
     });
     $this->assertPattern($pattern, $result);
     $result = String::uuid(function ($value) {
         if ($value == 'HOST') {
             return '127.0.0.1';
         }
     });
     $this->assertPattern($pattern, $result);
     $result = String::uuid(function ($value) {
         if ($value == 'SERVER_ADDR') {
             return '127.0.0.2';
         }
     });
     $this->assertPattern($pattern, $result);
 }
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:27,代码来源:StringTest.php

示例5: key

 /**
  * Obtain the session key.
  *
  * For this adapter, it is a UUID.
  *
  * @return string UUID.
  */
 public static function key()
 {
     return String::uuid();
 }
开发者ID:nilamdoc,项目名称:KYCGlobal,代码行数:11,代码来源:Memory.php

示例6: testUpdate

 public function testUpdate()
 {
     $this->_createGalleriesWithImages();
     $options = array('conditions' => array('gallery_id' => 1));
     $uuid = String::uuid();
     $image = Images::find('first', $options);
     $image->title = $uuid;
     $firstID = $image->id;
     $image->save();
     $this->assertEqual($uuid, Images::find('first', $options)->title);
     $uuid = String::uuid();
     Images::update(array('title' => $uuid), array('id' => $firstID));
     $this->assertEqual($uuid, Images::find('first', $options)->title);
     $this->images[0]['title'] = $uuid;
 }
开发者ID:davidpersson,项目名称:FrameworkBenchmarks,代码行数:15,代码来源:DatabaseTest.php


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