PHP and COM : error “Invalid syntax”

2019-07-25 14:12发布

问题:

I'm trying to connect to a dll that was supplied to me, I don't have the ability to edit it. Is the "Invalid syntax" error refering to a method within the dll or something with the php code?

try {
    $testConnection = new COM("SomebodySpecial.DLL");
} catch (com_exception $e) {
    echo "
";
    print_r( array( 'errorCode' => $e->getCode(),
                    'errorMessage' => $e->getMessage(),
                    'errorFile' => $e->getFile(),
                    'errorLine' => $e->getLine()));  
    echo "
"; } [errorCode] => -2147221020 [errorMessage] => Failed to create COM object `SomebodySpecial.DLL': Invalid syntax [errorFile] => D:\Inetpub\wwwroot-dev\test.php [errorLine] => 9

回答1:

As the error message indicates, you provided an invalid parameter to the COM constructor.

The parameter is a COM ID, not a DLL filename.



标签: php dll