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


PHP COM::instancesof方法代码示例

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


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

示例1: _get_system_name

function _get_system_name()
{
    if (IS_WINDOWS_OS == true) {
        // Get System Version for Windows Operating System
        $obj = new COM('winmgmts:{impersonationLevel=impersonate}//./root/cimv2');
        foreach ($obj->instancesof("Win32_OperatingSystem") as $mp) {
            $system_version = $mp->Caption;
            break;
        }
    } elseif (IS_DARWIN_OS == true) {
        // Get System Version for Mac OS X (Darwin)
        $version_info = @shell_exec("system_profiler SPSoftwareDataType");
        if ($version_info === false) {
            return false;
        } else {
            preg_match("#System Version: ([^\n]+)#i", $version_info, $matches);
            if (isset($matches['1']) === false) {
                return false;
            } else {
                $system_version = $matches['1'];
            }
        }
    } else {
        // Get System Version for Linux/Unix Operating Systems
        $version_info = @shell_exec("cat /etc/issue");
        if ($version_info === false) {
            return false;
        } else {
            $system_version = str_replace(array("\\n", "\\l"), NULl, trim($version_info));
        }
    }
    // Output System Version
    return isset($system_version) === false ? false : (string) $system_version;
}
开发者ID:goXXip,项目名称:mihalismmh,代码行数:34,代码来源:sysinfo.php

示例2: array

//ARRAYS ARE NOT COMMA SEPERATED YET
foreach ($colItems as $objItem) {
    $strRoles = array($objItem->Roles);
    $strInitialLoadInfo = array($objItem->InitialLoadInfo);
    $strOEMLogoBitmap = array($objItem->OEMLogoBitmap);
    $strOEMStringArray = array($objItem->OEMStringArray);
    $strPowerManagementCapabilities = array($objItem->PowerManagementCapabilities);
    $strSupportContactDescription = array($objItem->SupportContactDescription);
    $strSystemStartupOptions = array($objItem->SystemStartupOptions);
    $return_data['asset'] = array("AdminPasswordStatus" => $objItem->AdminPasswordStatus, "AutomaticManagedPagefile" => $objItem->AutomaticManagedPagefile, "AutomaticResetBootOption" => $objItem->AutomaticResetBootOption, "AutomaticResetCapability" => $objItem->AutomaticResetCapability, "BootOptionOnLimit" => $objItem->BootOptionOnLimit, "BootOptionOnWatchDog" => $objItem->BootOptionOnWatchDog, "BootROMSupported" => $objItem->BootROMSupported, "BootupState" => $objItem->BootupState, "Caption" => $objItem->Caption, "ChassisBootupState" => $objItem->ChassisBootupState, "CreationClassName" => $objItem->CreationClassName, "CurrentTimeZone" => $objItem->CurrentTimeZone, "DaylightInEffect" => $objItem->DaylightInEffect, "Description" => $objItem->Description, "DNSHostName" => $objItem->DNSHostName, "Domain" => $objItem->Domain, "DomainRole" => $objItem->DomainRole, "EnableDaylightSavingsTime" => $objItem->EnableDaylightSavingsTime, "FrontPanelResetStatus" => $objItem->FrontPanelResetStatus, "InfraredSupported" => $objItem->InfraredSupported, "InitialLoadInfo" => $strInitialLoadInfo, "KeyboardPasswordStatus" => $objItem->KeyboardPasswordStatus, "LastLoadInfo" => $objItem->LastLoadInfo, "Manufacturer" => $objItem->Manufacturer, "Model" => $objItem->Model, "Name" => $objItem->Name, "NameFormat" => $objItem->NameFormat, "NetworkServerModeEnabled" => $objItem->NetworkServerModeEnabled, "NumberOfLogicalProcessors" => $objItem->NumberOfLogicalProcessors, "NumberOfProcessors" => $objItem->NumberOfProcessors, "OEMLogoBitmap" => $strOEMLogoBitmap, "OEMStringArray" => $strOEMStringArray, "PartOfDomain" => $objItem->PartOfDomain, "PauseAfterReset" => $objItem->PauseAfterReset, "PCSystemType" => $objItem->PCSystemType, "PowerManagementCapabilities" => $strPowerManagementCapabilities, "PowerManagementSupported" => $objItem->PowerManagementSupported, "PowerOnPasswordStatus" => $objItem->PowerOnPasswordStatus, "PowerState" => $objItem->PowerState, "PowerSupplyState" => $objItem->PowerSupplyState, "PrimaryOwnerContact" => $objItem->PrimaryOwnerContact, "PrimaryOwnerName" => $objItem->PrimaryOwnerName, "ResetCapability" => $objItem->ResetCapability, "ResetCount" => $objItem->ResetCount, "ResetLimit" => $objItem->ResetLimit, "Roles" => $strRoles, "Status" => $objItem->Status, "SupportContactDescription" => $strSupportContactDescription, "SystemStartupDelay" => $objItem->SystemStartupDelay, "SystemStartupOptions" => $strSystemStartupOptions, "SystemStartupSetting" => $objItem->SystemStartupSetting, "SystemType" => $objItem->SystemType, "ThermalState" => $objItem->ThermalState, "TotalPhysicalMemory" => $objItem->TotalPhysicalMemory, "UserName" => $objItem->UserName, "WakeUpType" => $objItem->WakeUpType, "Workgroup" => $objItem->Workgroup);
}
// ---- Pull Event Log Data
$return_data['events'] = array();
$x = 0;
$colItems = $objWMIService->ExecQuery("SELECT * FROM Win32_NTLogEvent");
foreach ($objWMIService->instancesof("Win32_NTLogEvent") as $objItem) {
    $return_data['events'][$x] = array();
    foreach ($objects_array as $disp_obj => $disp_type) {
        if ($disp_type == "string") {
            $return_data['events'][$x][$disp_obj] = trim($objItem->{$disp_obj});
        } else {
            if ($disp_type == "time") {
                $return_data['events'][$x][$disp_obj] = win_time($objItem->{$disp_obj});
            } else {
                if ($disp_type == "array") {
                    if ($objItem->{$disp_obj} != NULL) {
                        $return_data['events'][$x][$disp_obj] = array();
                        foreach ($objItem->{$disp_obj} as $string) {
                            $return_data['events'][$x][$disp_obj][] = $string;
                        }
                    }
开发者ID:JhunCabas,项目名称:avarice-nms,代码行数:31,代码来源:log-puller.php


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