php中的资源是什么意思,PHP 和 COM

用户评论:

microtrash at at gmail dot com (2008-07-09 11:29:52)

In reference to question 1:

On one project I had a dll that exposed certain functions I wished to call from within PHP. I created a PHP Module which had a matching function for each in the DLL. The PHP Module did no processing, merely served as an adapter for the original DLL.

codeslinger at compsalot dot com (2007-01-27 05:18:59)

in response to item #1 above: "If this is a simple DLL there is no way yet to run it from PHP."

Answer: There are several different packages/add-ons to php that enable low level access to the windows api. One of the most popular of these packages is available at http://www.winbinder.org

Winbinder does have the ability to load a dll and call it's functions. Winbinder also provides a large set of windows apis for creating windows and controls. This is useful for creating stand-alone desktop apps. It is a possible alternative to php-gtk.

I've had mixed results with Winbinder, some things work very well, others are buggy; source code is available. It's worth a look, Evaluate carefully.

(2005-07-17 04:56:41)

Re: The Windows English CHM Sample with MS Word Automation.

I see that $Word->Release() is called after $Word->Quit().

This seems to be erroneous. Actually, $Word->Release() should not have to be called if proper COM garbage collection is taking place. Release() is a C++ construction not used in either Visual Basic or VBScript or even MS-JScript. Just to be sure, however, I ran the sample through php.exe (5.04 CLI on Windows XP SP1 with Office 2003) and got a RPC failed error on the line containing $Word->Release(). The rest of the sample works fine, and the results are as expected. So, I propose 2 scenarios:

1.There is a problem with the documentation (more likely).

2.There is a problem with PHP504 itself, as this problem is reproduced with any COM Automation call, not just Word.

jeanpierre dot vincent at gmail dot com (2005-02-03 06:56:13)

Be careful with function com_event_sink(), it doesn't totally work : when catching events, all parameters given to your callback function have the same value as the last one => see bug http://bugs.php.net/bug.php?id=31040

junk.ghost@virgin dOtt net (2004-10-05 09:27:23)

It may be obvious to everyone else but...

If you want to write your own COM DLL in MSVC++6 and you want to pass it a string, you need the following in your .idl file:

HRESULT function_name([in] BSTR parameter_name,

[retval, out] BSTR * retval);

retval is the result of your function as a string to be passed back.

BSTR is an unsigned short *, so if you want to use your string with STL string etc. you may need to convert parameters to and from char *.

The burden of my message is that from PHP

$comThing = new COM("comThing.comThing");

print $comThing->function_name("Jeremy");

Jeremy will be marshalled as wide chars, which match BSTR.

ALAN at DONTSPAMMEE;HOGAR dot COM (2002-08-16 21:39:43)

ONE SAMPLE USING MS-XML3 PARSER ON WINDOWS

$xml= new COM("Microsoft.XMLDOM");

$xml->async=false;

$xml->load("STYLE.xml");

$xsl = new COM("Microsoft.XMLDOM");

$xsl->async=false;

$xsl->load("STYLE.xsl");

$response=$xml->transformNode($xsl);

print $response;

?>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值