Fatal error: Class 'COM' not found PHP. Win7 - Apache - PHP

后端 未结 2 1931
再見小時候
再見小時候 2021-02-09 13:52
$myapp = new COM(\"word.application\");
// returns a fatal error: \"Class \'COM\' not found in c:/www/comConnector.php\"

shell_exec(\"whoami\");
//returns \"NT authorit         


        
相关标签:
2条回答
  • 2021-02-09 14:27

    Since you are using PHP 5.3.16, make sure that you are pointing to the global namespace:

    $myapp = new \COM("word.application");
    

    Even though your PHP file might be in global namespace already, but it's a good practice.

    0 讨论(0)
  • 2021-02-09 14:32

    Add COM support in php.ini:

     [COM_DOT_NET]
         extension=php_com_dotnet.dll
    
    0 讨论(0)
提交回复
热议问题