當前位置: 首頁>>代碼示例>>PHP>>正文


PHP COM::Namespace方法代碼示例

本文整理匯總了PHP中COM::Namespace方法的典型用法代碼示例。如果您正苦於以下問題:PHP COM::Namespace方法的具體用法?PHP COM::Namespace怎麽用?PHP COM::Namespace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在COM的用法示例。


在下文中一共展示了COM::Namespace方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: array

<?php

//http://technet.microsoft.com/en-us/library/ee176615.aspx
header("Content-Type: text/plain");
$arrHeaders = array(284);
//XP Only has 40 or so possible meta-data types
$objShell = new COM("Shell.Application");
$objFolder = $objShell->Namespace('c:\\temp');
//Change to suit the proper path
for ($i = 0; $i <= 283; $i = $i + 1) {
    $arrHeaders[$i] = $objFolder->GetDetailsOf($objFolder->Items, $i);
}
foreach ($objFolder->Items as $strFileName) {
    for ($i = 0; $i <= 283; $i = $i + 1) {
        echo $i . "\t" . $arrHeaders[$i] . ": " . $objFolder->GetDetailsOf($strFileName, $i) . "\r\n";
    }
}
開發者ID:JhunCabas,項目名稱:avarice-nms,代碼行數:17,代碼來源:file-details.php

示例2: foreach

 foreach ($files as $fkey => $filel) {
     if ($fkey != 'sourceName') {
         $filelist = explode(";", $filel);
         foreach ($filelist as $file) {
             unset($output);
             $file = str_ireplace(array("%systemroot%", "%programfiles%"), array(getenv('SYSTEMROOT'), getenv('PROGRAMFILES')), $file);
             if (!is_file($file) and !is_file(getenv('SYSTEMROOT') . "\\system32\\" . $file)) {
                 continue;
             } else {
                 if (!is_file($file)) {
                     $file = getenv('SYSTEMROOT') . "\\system32\\" . $file;
                 }
             }
             // Use this info to see if file already exists in DB
             $mf_filename = substr(strrchr($file, "\\"), 1);
             $objFolder = $objShell->Namespace(substr($file, 0, strrpos($file, "\\")));
             $fileVersion = $objFolder->GetDetailsOf($objFolder->ParseName($mf_filename), 156);
             $productVersion = $objFolder->GetDetailsOf($objFolder->ParseName($mf_filename), 271);
             $fileModified = date('Y-m-d H:i:s', strtotime($objFolder->GetDetailsOf($objFolder->ParseName($mf_filename), 3)));
             $fileCreated = date('Y-m-d H:i:s', strtotime($objFolder->GetDetailsOf($objFolder->ParseName($mf_filename), 4)));
             $file_hash = hash_file("md5", $file);
             $query = "\r\n\t\t\t\t\t\tselect\r\n\t\t\t\t\t\t\tmessageFileID\r\n\t\t\t\t\t\tfrom\r\n\t\t\t\t\t\t\tmessageFile\r\n\t\t\t\t\t\twhere\r\n\t\t\t\t\t\t\tfile = '" . $mf_filename . "'\r\n\t\t\t\t\t\t\tand fileVersion = '" . $fileVersion . "'\r\n\t\t\t\t\t\t\tand productVersion = '" . $productVersion . "'\r\n\t\t\t\t\t\t\tand fileModified = '" . $fileModified . "'\r\n\t\t\t\t\t\t\tand fileHash = '" . $file_hash . "';";
             $result = $dbh->query($query)->fetch();
             $messageFileID = $result['messageFileID'];
             // if file !exists use wrcinfo.exe to get messages
             if (empty($messageFileID)) {
                 $insertQuery = "\r\n\t\t\t\t\t\t\tinsert into messageFile\r\n\t\t\t\t\t\t\t\t(file, fileVersion, productVersion, fileCreated, fileModified, createdDate, fileHash)\r\n\t\t\t\t\t\t\tvalues\r\n\t\t\t\t\t\t\t\t('" . $mf_filename . "','" . $fileVersion . "','" . $productVersion . "','" . $fileCreated . "','" . $fileModified . "','" . date('Y-m-d H:i:s', $runTimeEvent) . "','" . $file_hash . "');";
                 $dbh->exec($insertQuery);
                 $result = $dbh->query($query)->fetch();
                 $messageFileID = $result['messageFileID'];
                 exec("wrcinfo.exe \"" . $file . "\"", $output);
開發者ID:JhunCabas,項目名稱:avarice-nms,代碼行數:31,代碼來源:eventlog.php


注:本文中的COM::Namespace方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。