在Windows资源管理器中,它们是一个摘要选项卡,其中包含每个文件的标题,主题,作者,类别,关键字和注释。是否可以使用php读取和编辑这些数据?
答案 0 :(得分:2)
对于许多应用程序,您无法在Windows中使用PHP获取有意义的元数据。唯一真正的例外是使用PHP的组件对象模型。
参考
以下是word / excel的示例:
// for MSExcel use:
$objOfficeApp = new COM("excel.application") or die("unable to instantiate MSExcel");
// for MSWord use:
//$objOfficeApp = new COM("word.application") or die("unable to instantiate MSWord");
$objOfficeApp->Workbooks->Open( "c:\\temp\\test.xls" );
//$objOfficeApp->Documents->Open( "c:\\temp\\test.doc" );
$objDocProps = $objOfficeApp->ActiveWorkBook->BuiltInDocumentProperties();
//$objDocProps = $objOfficeApp->ActiveDocument->BuiltInDocumentProperties();
$count = $objDocProps->count();
while( $objDocProp = $objDocProps->Next() ) {
print $objDocProp->Name() . ': ' . $objDocProp->Value() . "\n";
}
unset($objDocProp);
unset($objDocProps);
$objOfficeApp->ActiveWorkBook->Close();
//$objOfficeApp->ActiveDocument->Close();
$objOfficeApp->Quit();
unset($objOfficeApp);