2

Is it possible to use ActiveX in PHP? I want to use an ActiveX in my server-side PHP code.


I'm trying to load an Activex in my PHP code, As I know this can be done with COM function in PHP, so I try to access my methods as below:

<?PHP
$active = new COM("sswATL.crypto");
//------------------------

$pass = "pincode";

$ret = $active->init( $pass , $retVal);

if($retVal == 0){ 
   print "Login successfully";
}
elseif($retVal == 4){

   print "Token is not present";
} 
else
{
   $errMsg = "Login failed : "; 
   print $errMsg;
  }
?>

but I got this error:

Fatal error: Uncaught exception 'com_exception'
with message '<b>Source:</b> Unknown<br/><b>Description:</b> Unknown'
in C:\my\php\file\path.php
Stack trace:
#0 C:\my\php\file\path.php: com->init('pincode', NULL)
#1 {main}
thrown in C:\my\php\file\path.php on line 7

init method is declared as:

int init(string s,int &num);

any ideas?

4

2 回答 2

1

您可以使用COM 函数使用 ActiveX

可以在此处找到有关 COM 类的良好文档。

于 2012-09-11T05:39:54.793 回答
1

使用 COM 类调用 ActiveX:http ://cn.php.net/manual/en/book.com.php

function clsMSWord($Visible = false) { 
    $this->handle = new COM("word.application") or die("Unable to instanciate Word"); 
    $this->handle->Visible = $Visible; 
} 
于 2012-09-11T05:41:56.757 回答