Fecshop

Fecshop

FecMall

  • 财富值2381
  • 威望值490
  • 总积分8011

个人信息

  • https://mirrors.aliyun.com/composer could not be fully loaded (curl error 61 while downloading https://mirrors.aliyun.com/composer/p2/hightman/xunsearch.json

    估计是网络问题。

  • @yii\swiftmailer\Mailer

  • 这个肯定是不可以的,除非浏览器有bug

  • 你这个应该改个名字: UUID , 用户唯一标识。

    js收集用户数据,就用的这个玩意。

  • 赞了回答
    class MacUtil
    {
        var $result = array();
        var $macAddrs = array(); //所有mac地址
        var $macAddr;            //第一个mac地址
    
        public function __construct($OS = PHP_OS)
        {
            $this->GetMac($OS);
        }
    
        public function GetMac($OS)
        {
            switch (strtolower($OS)) {
                case "unix":
                    break;
                case "solaris":
                    break;
                case "aix":
                    break;
                case "linux":
                    $this->getLinux();
                    break;
                default:
                    $this->getWindows();
                    break;
            }
            $tem = array();
            foreach ($this->result as $val) {
                if (preg_match("/[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f][:-]" . "[0-9a-f][0-9a-f]/i", $val, $tem)) {
                    $this->macAddr = $tem[0];//多个网卡时,会返回第一个网卡的mac地址,一般够用。
                    break;
                    //$this->macAddrs[] = $temp_array[0];//返回所有的mac地址
                }
            }
            unset($temp_array);
            return $this->macAddr;
        }
    
        //Linux系统
        public function getLinux()
        {
            @exec("ifconfig -a", $this->result);
            return $this->result;
        }
    
        //Windows系统
        public function getWindows()
        {
            @exec("ipconfig /all", $this->result);
            if ($this->result) {
                return $this->result;
            } else {
                $ipconfig = $_SERVER["WINDIR"] . "\system32\ipconfig.exe";
                if (is_file($ipconfig)) {
                    @exec($ipconfig . " /all", $this->result);
                } else {
                    @exec($_SERVER["WINDIR"] . "\system\ipconfig.exe /all", $this->result);
                    return $this->result;
                }
            }
        }
    
        /**
         * mac合法性校验 兼容大小写和(:-)
         * @param $mac
         * @return bool
         */
        public function mac_check($mac)
        {
            if (empty($mac)) {
                return FALSE;
            }
    
            $mac_reg = '/^([0-9a-fA-F]{2})((([:][0-9a-fA-F]{2}){5})|(([-][0-9a-fA-F]{2}){5}))$/i';
            return preg_match($mac_reg, $mac) == 1 ? TRUE : FALSE;
        }
    
        /**
         * mac 转化为数字表示
         * @param $mac_str
         * @return bool|number
         */
        public function macToInt($mac_str)
        {
            if (!$this->mac_check($mac_str)) return FALSE;
    
            $filter_mac = strtolower(preg_replace('/[:-]/', '', $mac_str));
            $mac_int = hexdec($filter_mac);
            if (is_numeric($mac_int))
                return $mac_int;
            else
                return FALSE;
        }
    
        /**
         * 数字转换为标准mac
         * @param $mac_int
         * @param string $chain ('-', ':')
         * @return bool|string
         */
        public function intToMac($mac_int, $chain = '-')
        {
            $max_value = 281474976710655;
            $min_value = 0;
            if (!is_numeric($mac_int) || $mac_int > $max_value || $mac_int < $min_value) return FALSE;
    
            $chain_list = array('-', ':');
            if (!in_array($chain, $chain_list)) return FALSE;
    
            $mac_hex = dechex($mac_int);
            $mac_str = strval($mac_hex);
            $mac_hex_len = strlen($mac_hex);
            if ($mac_hex_len < 12) {
                $add_len = 12 - $mac_hex_len;
                $add_str = '';
                while ($add_len--) {
                    $add_str .= '0';
                }
                $mac_str = $add_str . $mac_str;
            }
            $mac_arr = str_split($mac_str, 2);
            $mac_full_str = implode($chain, $mac_arr);
    
    
            if (!$this->mac_check($mac_full_str)) {
                return FALSE;
            } else {
                $res = str_replace("-", ":", strtoupper($mac_full_str));
                return $res;
            }
        }
    }
    
  • 顶顶顶顶顶顶顶顶

  • 赞了话题
    PHP 8 已经发布!
  • 回复了 的说说
    寄蜉蝣于天地,渺沧海之一粟;哀吾生之须臾,羡长江之无穷
    苏轼:模仿李勃的滕王阁序的句子
  • 赞了说说
    ☆☆☆☆☆☆☆☆☆☆☆距离春节还有: 68天!☆☆☆☆PHP8为您提供快捷方便的时间管理,★我是时间管理大师罗致翔。
副总裁 等级规则
8011/10000
资料完整度
100/100
用户活跃度
0/100

Ta的关注

0

Ta的粉丝

157

Ta的访客

477