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


PHP uuid_create函数代码示例

本文整理汇总了PHP中uuid_create函数的典型用法代码示例。如果您正苦于以下问题:PHP uuid_create函数的具体用法?PHP uuid_create怎么用?PHP uuid_create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: UUID

 /**
  * Universally Unique Identifier v4
  *
  * @param  int   $b
  * @return UUID, if $b returns binary(16)
  */
 public function UUID($b = null)
 {
     if ($this->debug) {
         $this->debug->log(__METHOD__);
     }
     if (function_exists('uuid_create')) {
         $uuid = uuid_create();
     } else {
         $uuid = sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xfff) | 0x4000, mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff));
     }
     return $b ? pack('H*', str_replace('-', '', $uuid)) : $uuid;
 }
开发者ID:nbari,项目名称:DALMP,代码行数:18,代码来源:Database.php

示例2: generate

 /**
  * {@inheritdoc}
  */
 public function generate(EntityManager $em, $entity)
 {
     if (defined('PHP_WINDOWS_VERSION_BUILD')) {
         return substr(com_create_guid(), 1, 36);
     }
     return uuid_create(UUID_TYPE_RANDOM);
 }
开发者ID:creof,项目名称:doctrine2-php-uuid-generator,代码行数:10,代码来源:PhpUuidGenerator.php

示例3: companies_viewcontent_alm_customers_BeforeInsert

function companies_viewcontent_alm_customers_BeforeInsert(&$sender)
{
    $companies_viewcontent_alm_customers_BeforeInsert = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $companies_viewcontent;
    //Compatibility
    //End companies_viewcontent_alm_customers_BeforeInsert
    //Custom Code @26-2A29BDB7
    // -------------------------
    // Write your own code here.
    $guid = uuid_create();
    global $lastguid;
    $lastguid = $guid;
    $userid = CCGetUserID();
    $businesspartner = CCGetFromPost("businesspartner", array());
    $businesspartner_list = "";
    foreach ($businesspartner as $partner) {
        $businesspartner_list .= $partner . ",";
    }
    $companies_viewcontent->alm_customers->businesspartner->SetValue($businesspartner_list);
    $companies_viewcontent->alm_customers->created_iduser->SetValue($userid);
    $companies_viewcontent->alm_customers->hidguid->SetValue($guid);
    $companies_viewcontent->alm_customers->assigned_to->SetValue($userid);
    // -------------------------
    //End Custom Code
    //Close companies_viewcontent_alm_customers_BeforeInsert @2-560BEAB8
    return $companies_viewcontent_alm_customers_BeforeInsert;
}
开发者ID:wangshipeng,项目名称:license_manager,代码行数:29,代码来源:companies_viewcontent_events.php

示例4: instance

 private static function instance()
 {
     if (!is_resource(self::$_uuid)) {
         uuid_create(&self::$_uuid);
     }
     return self::$_uuid;
 }
开发者ID:jlaprise,项目名称:Pandra,代码行数:7,代码来源:UUID.class.php

示例5: generateUUID

 /**
  * Generates a universally unique identifier (UUID) according to RFC 4122.
  * The algorithm used here, might not be completely random.
  *
  * If php-uuid was installed it will be used instead to speed up the process.
  *
  * @return string The universally unique id
  * @todo Optionally generate type 1 and type 5 UUIDs.
  */
 public static function generateUUID()
 {
     if (is_callable('uuid_create')) {
         return strtolower(uuid_create(UUID_TYPE_RANDOM));
     }
     return (string) Uuid::uuid4();
 }
开发者ID:cerlestes,项目名称:flow-development-collection,代码行数:16,代码来源:Algorithms.php

示例6: loadEmpty

 /**
  * Initialize an empty calendar.
  * @param array $defaults
  * @return \QuipXml\Xml\QuipXmlElement
  */
 public static function loadEmpty($defaults = NULL)
 {
     $uid = function_exists('uuid_create') ? uuid_create() : uniqid('quip-cal-');
     $defaults = array_merge(array('uid' => $uid, 'name' => 'New Calendar', 'timezone' => 'Etc/UTC'), (array) $defaults);
     $ical = implode("\n", array('BEGIN:VCALENDAR', 'VERSION:2.0', 'PRODID:QuipCalendar', 'CALSCALE:GREGORIAN', 'UID:' . $defaults['uid'], 'X-WR-CALNAME:' . $defaults['name'], 'X-WR-TIMEZONE:' . $defaults['timezone'], 'END:VCALENDAR'));
     return QuipCalendar::loadIcal($ical);
 }
开发者ID:wittiws,项目名称:quipxml,代码行数:12,代码来源:QuipCalendar.php

示例7: generateId

 public function generateId()
 {
     if (extension_loaded('uuid')) {
         return uuid_create();
     }
     // @codingStandardsIgnoreStart
     return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xfff) | 0x4000, mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff));
     // @codingStandardsIgnoreEnd
 }
开发者ID:metro-q,项目名称:metro,代码行数:9,代码来源:UuidGenerator.php

示例8: generate

 /**
  * generate
  *
  * v4
  */
 public static function generate()
 {
     if (!function_exists('uuid_create')) {
         return false;
     }
     uuid_create(&$context);
     uuid_make($context, UUID_MAKE_V4);
     uuid_export($context, UUID_FMT_STR, &$uuid);
     return trim($uuid);
 }
开发者ID:highhair20,项目名称:glo,代码行数:15,代码来源:Uuid.php

示例9: getId

 /**
  * 生成UUID
  * @param  string $value 待解密字符串
  * @return string
  */
 public function getId()
 {
     if (function_exists('uuid_create') && !function_exists('uuid_make')) {
         $id = uuid_create(UUID_TYPE_DEFAULT);
     } elseif (function_exists('com_create_guid')) {
         $id = strtolower(trim(com_create_guid(), '{}'));
     } else {
         $id = $this->createId();
     }
     return $id;
 }
开发者ID:connwap135,项目名称:ectouch,代码行数:16,代码来源:Encrypter.php

示例10: generateUuid

 public function generateUuid()
 {
     // what are we doing?
     $log = usingLog()->startAction("generate a UUID");
     // do we have the UUID extension?
     $uuid = uuid_create();
     // log it
     $log->endAction("'{$uuid}'");
     // all done
     return $uuid;
 }
开发者ID:datasift,项目名称:storyplayer,代码行数:11,代码来源:FromUuid.php

示例11: v5

 /**
  * Generates version 5 UUID: SHA-1 hash of URL
  */
 public static function v5($i_url)
 {
     if (!function_exists('uuid_create')) {
         return false;
     }
     if (!strlen($i_url)) {
         $i_url = self::v1();
     }
     uuid_create(&$context);
     uuid_create(&$namespace);
     uuid_make($context, UUID_MAKE_V5, $namespace, $i_url);
     uuid_export($context, UUID_FMT_STR, &$uuid);
     return trim($uuid);
 }
开发者ID:rolwi,项目名称:koala,代码行数:17,代码来源:UUIDWrapper.class.php

示例12: ensure

 /**
  * On long running deamons i've seen a lost resource. This checks the resource and creates it if needed.
  *
  */
 protected static function ensure()
 {
     if (is_resource(self::$uuidobject)) {
         return true;
     }
     if (!iHRIS_Module_UUID_Map::hasUUID()) {
         return false;
     }
     uuid_create(&self::$uuidobject);
     if (!is_resource(self::$uuidobject)) {
         return false;
     }
     return true;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:18,代码来源:iHRIS_UUID_Map_ossp.php

示例13: generate

 /**
  * Generate a 36-character RFC 4122 UUID, without the urn:uuid: prefix.
  *
  * @see http://www.ietf.org/rfc/rfc4122.txt
  * @see http://labs.omniti.com/alexandria/trunk/OmniTI/Util/UUID.php
  */
 public function generate()
 {
     if (extension_loaded('uuid')) {
         $this->_uuid = uuid_create();
     } else {
         list($time_mid, $time_low) = explode(' ', microtime());
         $time_low = (int) $time_low;
         $time_mid = (int) substr($time_mid, 2) & 0xffff;
         $time_high = mt_rand(0, 0xfff) | 0x4000;
         $clock = mt_rand(0, 0x3fff) | 0x8000;
         $node_low = function_exists('zend_thread_id') ? zend_thread_id() : getmypid();
         $node_high = isset($_SERVER['SERVER_ADDR']) ? ip2long($_SERVER['SERVER_ADDR']) : crc32(php_uname());
         $node = bin2hex(pack('nN', $node_low, $node_high));
         $this->_uuid = sprintf('%08x-%04x-%04x-%04x-%s', $time_low, $time_mid, $time_high, $clock, $node);
     }
 }
开发者ID:netcon-source,项目名称:apps,代码行数:22,代码来源:Uuid.php

示例14: contacts_subhobbies_maintcontent_alm_customers_contacts_su_BeforeInsert

function contacts_subhobbies_maintcontent_alm_customers_contacts_su_BeforeInsert(&$sender)
{
    $contacts_subhobbies_maintcontent_alm_customers_contacts_su_BeforeInsert = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $contacts_subhobbies_maintcontent;
    //Compatibility
    //End contacts_subhobbies_maintcontent_alm_customers_contacts_su_BeforeInsert
    //Custom Code @13-2A29BDB7
    // -------------------------
    // Write your own code here.
    $guid = uuid_create();
    $contacts_subhobbies_maintcontent->alm_customers_contacts_su->created_iduser->SetValue(CCGetUserID());
    $contacts_subhobbies_maintcontent->alm_customers_contacts_su->hidguid->SetValue($guid);
    // -------------------------
    //End Custom Code
    //Close contacts_subhobbies_maintcontent_alm_customers_contacts_su_BeforeInsert @2-71F6BE98
    return $contacts_subhobbies_maintcontent_alm_customers_contacts_su_BeforeInsert;
}
开发者ID:wangshipeng,项目名称:license_manager,代码行数:19,代码来源:contacts_subhobbies_maintcontent_events.php

示例15: settings_maintcontent_options_BeforeInsert

function settings_maintcontent_options_BeforeInsert(&$sender)
{
    $settings_maintcontent_options_BeforeInsert = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $settings_maintcontent;
    //Compatibility
    //End settings_maintcontent_options_BeforeInsert
    //Custom Code @15-2A29BDB7
    // -------------------------
    // Write your own code here.
    $guid = uuid_create();
    $settings_maintcontent->options->hidguid->SetValue($guid);
    $settings_maintcontent->options->created_iduser->SetValue(CCGetUserID());
    // -------------------------
    //End Custom Code
    //Close settings_maintcontent_options_BeforeInsert @5-59596C86
    return $settings_maintcontent_options_BeforeInsert;
}
开发者ID:wangshipeng,项目名称:license_manager,代码行数:19,代码来源:settings_maintcontent_events.php


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