我想调用一个外部dll文件,按照网站的介绍:
 
    $mycom = new COM ("M3_Encrypt.M3Encryption") or die ("error");//mycom.myclassname 点前面是你dll的名字,点后面是你在 com中定义的类的名字。 
    $_eout=com_invoke($mycom,"EncryptString",$_key,"m3cn");//有几个参数就写几个para。 
    $mycom ->Release(); 
 
  但是报:没有定义com_invoke()这函数的错误.....  Fatal error: Call to undefined function com_invoke()     请问使用这种方法要注意确保什么吗?或者有谁知道如何解决吗?或者有什么其它办法也可以调用dll文件吗???

解决方案 »

  1.   

    Requirements
    COM functions are only available for the Windows version of PHP. .Net support requires PHP 5 and the .Net runtime. 
      

  2.   

    我的php就是win版本了,,,具体要如何才能解决呢?
      

  3.   

    我也想知道PHP调用控件的方法
      

  4.   

    其实我知道原因了:php5后就不支持com_invoke()这个函数了......但是我还是没有找到解决的办法..
      

  5.   

    你编译的DLL在创建的时候就要以COM组件的方式编译,PHP调用的时候也要通过COM来调用
    给你个例子
    //首先注册:regsvr32 KeyEncrypt_COM.dll
    //卸载使用:regsvr32 /u KeyEncrypt_COM.dll
    //KeyEncrypt_COM.dll内部有一个函数:HexStrEncrypt(BSTR inHexStr, BSTR *outHexStr),会将*outHexStr赋值一个字符串返回 $com = new COM("KeyEncrypt_COM.HexStrEncrypt") or die("Cannot Use HexStrEncrypt");
    $result = "未处理的字符串";
    echo '$result = '.$result.'<br>';

    $result = $com->HexStrEncrypt("abc");
    echo '$result = '.$result.'<br>';

    $com = null;
      

  6.   

    php 支持调用注册 dll 文件。