Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将Apple设备模型标识符转换为PHP中的可读文本?_Php_Ios_Iphone - Fatal编程技术网

如何将Apple设备模型标识符转换为PHP中的可读文本?

如何将Apple设备模型标识符转换为PHP中的可读文本?,php,ios,iphone,Php,Ios,Iphone,有没有一种方法可以使用PHP轻松地将uname获得的标识符转换为人类可读的文本 因此,我的意思是iPhone6,1到iphone5s这里有一个我自己使用的函数,用于将这些标识符转换为设备名称: function identifierToString($model){ $models = array( "i386" => "Simulator", //iPhone Simulator "x86_64" => "

有没有一种方法可以使用PHP轻松地将
uname
获得的标识符转换为人类可读的文本


因此,我的意思是
iPhone6,1
iphone5s

这里有一个我自己使用的函数,用于将这些标识符转换为设备名称:

function identifierToString($model){
    $models = array(

        "i386"      => "Simulator",          //iPhone Simulator
        "x86_64"    => "Simulator",          //iPhone Simulator

        "iPhone1,1" => "iPhone 1G",          //iPhone 1G
        "iPhone1,2" => "iPhone 3G",          //iPhone 3G
        "iPhone2,1" => "iPhone 3GS",         //iPhone 3GS

        "iPhone3,1" => "iPhone 4",           //iPhone 4 - AT&T
        "iPhone3,2" => "iPhone 4",           //iPhone 4 - Other carrier
        "iPhone3,3" => "iPhone 4",           //iPhone 4 - Other carrier
        "iPhone4,1" => "iPhone 4S",          //iPhone 4S

        "iPhone5,1" => "iPhone 5",           //iPhone 5
        "iPhone5,2" => "iPhone 5",           //iPhone 5
        "iPhone5,3" => "iPhone 5C",          //iPhone 5C
        "iPhone5,4" => "iPhone 5C",          //iPhone 5C
        "iPhone6,1" => "iPhone 5S",          //iPhone 5S
        "iPhone6,2" => "iPhone 5S",          //iPhone 5S
        "iPhone7,2" => "iPhone 6",          //iPhone 6

        "iPod1,1"   => "iPod 1st Gen",       //iPod Touch 1G
        "iPod2,1"   => "iPod 2nd Gen",       //iPod Touch 2G
        "iPod3,1"   => "iPod 3rd Gen",       //iPod Touch 3G
        "iPod4,1"   => "iPod 4th Gen",       //iPod Touch 4G
        "iPod5,1"   => "iPod 5th Gen",       //iPod Touch 5G

        "iPad1,1"   => "iPad 1",             //iPad Wifi

        "iPad2,1"   => "iPad 2",             //iPad 2 WiFi
        "iPad2,2"   => "iPad 2 Cellular",    //iPad 2 GSM
        "iPad2,3"   => "iPad 2 Cellular",    //iPad 2 CDMA
        "iPad2,4"   => "iPad 2",             //iPad 2 WiFi (Rev a)

        "iPad3,1"   => "iPad 3",             //iPad 3 WiFi
        "iPad3,2"   => "iPad 3 Cellular",    //iPad 3 GSM+CDMA
        "iPad3,3"   => "iPad 3 Cellular",    //iPad 3 GSM

        "iPad3,4"   => "iPad 4",             //iPad 3 WiFi
        "iPad3,5"   => "iPad 4 Cellular",    //iPad 3 GSM
        "iPad3,6"   => "iPad 4 Cellular",    //iPad 3 GSM+CMMA

        "iPad4,1"   => "iPad Air",           //iPad Air WiFi
        "iPad4,2"   => "iPad Air Cellular",  //iPad Air Cellular

        "iPad2,5"   => "iPad Mini",
        "iPad2,6"   => "iPad Mini Cellular", // GSM
        "iPad2,7"   => "iPad Mini Cellular", // GSM+CDMA

        "iPad4,4"   => "iPad Mini Retina",
        "iPad4,5"   => "iPad Mini Retina Cellular",

    );

    if(isset($models[$model])){
        return $models[$model];
    } else {
        return $model;
    }

}

来源:

以下是我自己使用的一个函数,用于将这些标识符转换为设备名称:

function identifierToString($model){
    $models = array(

        "i386"      => "Simulator",          //iPhone Simulator
        "x86_64"    => "Simulator",          //iPhone Simulator

        "iPhone1,1" => "iPhone 1G",          //iPhone 1G
        "iPhone1,2" => "iPhone 3G",          //iPhone 3G
        "iPhone2,1" => "iPhone 3GS",         //iPhone 3GS

        "iPhone3,1" => "iPhone 4",           //iPhone 4 - AT&T
        "iPhone3,2" => "iPhone 4",           //iPhone 4 - Other carrier
        "iPhone3,3" => "iPhone 4",           //iPhone 4 - Other carrier
        "iPhone4,1" => "iPhone 4S",          //iPhone 4S

        "iPhone5,1" => "iPhone 5",           //iPhone 5
        "iPhone5,2" => "iPhone 5",           //iPhone 5
        "iPhone5,3" => "iPhone 5C",          //iPhone 5C
        "iPhone5,4" => "iPhone 5C",          //iPhone 5C
        "iPhone6,1" => "iPhone 5S",          //iPhone 5S
        "iPhone6,2" => "iPhone 5S",          //iPhone 5S
        "iPhone7,2" => "iPhone 6",          //iPhone 6

        "iPod1,1"   => "iPod 1st Gen",       //iPod Touch 1G
        "iPod2,1"   => "iPod 2nd Gen",       //iPod Touch 2G
        "iPod3,1"   => "iPod 3rd Gen",       //iPod Touch 3G
        "iPod4,1"   => "iPod 4th Gen",       //iPod Touch 4G
        "iPod5,1"   => "iPod 5th Gen",       //iPod Touch 5G

        "iPad1,1"   => "iPad 1",             //iPad Wifi

        "iPad2,1"   => "iPad 2",             //iPad 2 WiFi
        "iPad2,2"   => "iPad 2 Cellular",    //iPad 2 GSM
        "iPad2,3"   => "iPad 2 Cellular",    //iPad 2 CDMA
        "iPad2,4"   => "iPad 2",             //iPad 2 WiFi (Rev a)

        "iPad3,1"   => "iPad 3",             //iPad 3 WiFi
        "iPad3,2"   => "iPad 3 Cellular",    //iPad 3 GSM+CDMA
        "iPad3,3"   => "iPad 3 Cellular",    //iPad 3 GSM

        "iPad3,4"   => "iPad 4",             //iPad 3 WiFi
        "iPad3,5"   => "iPad 4 Cellular",    //iPad 3 GSM
        "iPad3,6"   => "iPad 4 Cellular",    //iPad 3 GSM+CMMA

        "iPad4,1"   => "iPad Air",           //iPad Air WiFi
        "iPad4,2"   => "iPad Air Cellular",  //iPad Air Cellular

        "iPad2,5"   => "iPad Mini",
        "iPad2,6"   => "iPad Mini Cellular", // GSM
        "iPad2,7"   => "iPad Mini Cellular", // GSM+CDMA

        "iPad4,4"   => "iPad Mini Retina",
        "iPad4,5"   => "iPad Mini Retina Cellular",

    );

    if(isset($models[$model])){
        return $models[$model];
    } else {
        return $model;
    }

}

来源:

你试过什么吗?你试过什么吗?Thanx!这正是我需要的!塔克斯!这正是我需要的!