是否可以在PHP中使用ActiveX?我想在我的服务器端PHP代码中使用ActiveX。
我正试图在我的PHP代码中加载一个Activex,因为我知道这可以用PHP中的COM函数来完成,所以我尝试访问我的方法如下:
<?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;
}
?>
但我得到了这个错误:
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方法声明为:
int init(string s,int &num);
有什么想法吗?
使用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;
}
您可以使用COM函数使用ActiveX
有关COM类的良好文档可以在此处找到。