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


PHP UUID::secLib方法代码示例

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


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

示例1: initBignum

 public static function initBignum($how = NULL)
 {
     /* Check to see if PHP is running in a 32-bit environment and if so,
        use GMP or BC Math if available. */
     if ($how === NULL) {
         if (self::$bignum != self::bigChoose) {
             // determination has already been made
             return self::$bignum;
         } else {
             if (PHP_INT_SIZE >= 8) {
                 self::$bignum = self::bigNative;
             } else {
                 if (function_exists("gmp_add")) {
                     self::$bignum = self::bigGMP;
                 } else {
                     if (function_exists("bcadd")) {
                         self::$bignum = self::bigBC;
                     } else {
                         if (class_exists("\\phpseclib\\Math\\BigInteger", 0)) {
                             // phpseclib v2.x
                             self::$bignum = self::bigSecLib;
                             self::$secLib = "\\phpseclib\\Math\\BigInteger";
                         } else {
                             if (class_exists("Math_BigInteger", 0)) {
                                 // phpseclib v1.x
                                 self::$bignum = self::bigSecLib;
                                 self::$secLib = "Math_BigInteger";
                             } else {
                                 self::$bignum = self::bigNot;
                             }
                         }
                     }
                 }
             }
         }
     } else {
         switch ($how) {
             case self::bigChoose:
                 self::$bignum = $how;
                 return self::initBignum();
             case self::bigNot:
                 break;
             case self::bigNative:
                 if (PHP_INT_SIZE < 8) {
                     throw new UUIDException("Bignum method is not available.", 801);
                 }
                 break;
             case self::bigGMP:
                 if (!function_exists("gmp_add")) {
                     throw new UUIDException("Bignum method is not available.", 801);
                 }
                 break;
             case self::bigBC:
                 if (!function_exists("bcadd")) {
                     throw new UUIDException("Bignum method is not available.", 801);
                 }
                 break;
             case self::bigSecLib:
                 if (class_exists("\\phpseclib\\Math\\BigInteger", 0)) {
                     //v2.x
                     self::$secLib = "\\phpseclib\\Math\\BigInteger";
                 } else {
                     if (class_exists("Math_BigInteger", 0)) {
                         //v1.x
                         self::$secLib = "Math_BigInteger";
                     } else {
                         throw new UUIDException("Bignum method is not available.", 801);
                     }
                 }
                 break;
             default:
                 throw new UUIDException("Bignum method not implemented.", 901);
         }
         self::$bignum = $how;
     }
     return self::$bignum;
 }
开发者ID:grandt,项目名称:phpepub,代码行数:77,代码来源:lib.uuid.php


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