本文整理汇总了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";
}
}
示例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);