我正在寻找一种PHP解决方案来识别文档(doc,docx,xls,xlsx)是否受密码保护?
有解决方案
$word=new COM("word.application") or die("Cannot create Word object");
$word->Visible=false;
$word->WindowState=2;
$word->DisplayAlerts=false;
// $doc = $word->Document->Open(realpath("C:\wamp\www\test\pro_1.docx"));
$doc = $word->Documents->Open(realpath("pro_1.docx"));
var_dump($doc);
exit();
$passwordProtect = $doc->Document->HasPassword;//true or false
var_dump($passwordProtect);
$word->ActiveDocument->Close(false);
$word->Quit();
$word->Release();
$word=null;
在此情况下,“文档”->“打开”是我的错误……其他更好的解决方案还是有人可以告诉我这段代码将如何工作?