Use DLL in PHP?

前端 未结 3 935
生来不讨喜
生来不讨喜 2021-02-09 02:30

I\'m not going to lie. I\'m not all the familiar with Windows and COM objects. That\'s why i\'m here. First of all is it possible to access a DLL from within a PHP script runnin

3条回答
  •  别那么骄傲
    2021-02-09 03:05

    You can run dll functions (from dlls which are not php extensions) with winbinder. http://winbinder.org/ Using it is simple. You have to download php_winbinder.dll and include it in php.ini as an extension. In the php script you have to use something similar:

    function callDll($func, $param = "")
    {
        static $dll = null;
        static $funcAddr = null;
        if ($dll === null)
        {
            $dll = wb_load_library();
        }
        $funcAddr = wb_get_function_address($func, $dll);
        if ($param != "")
        {
            return wb_call_function($funcAddr,array(mb_convert_encoding($param,"UTF-16LE")));
        }
        else
        {
            return wb_call_function($funcAddr);
        }
    }
    

提交回复
热议问题