如何使用 OLE_COLOR 作为参数从 PHP 调用 COM 函数?

发布于 2024-07-07 20:23:30 字数 189 浏览 8 评论 0原文

我正在尝试使用 COM 互操作扩展从 PHP 调用 COM 对象。 一个函数需要 OLE_COLOR 作为参数? 有什么方法可以从 PHP 传递这种值吗?

我尝试传递一个简单的整数值但没有成功。

$this->oBuilder->Font->Color = 255;

I am trying to call a COM object from PHP using the COM interop extension. One function requires an OLE_COLOR as an argument? Is there any way to pass this kind of value from PHP?

I have tried passing a simple integer value with no success.

$this->oBuilder->Font->Color = 255;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

花辞树 2024-07-14 20:23:30

PHP 可以自动定义 COM 公开的常量。

set_ini('com.autoregister-typelib ', 真的);

或手动

com_load_typelib($typelib_name);

但如果 OLE_COLOR 是一个对象而不是整数、字符串或其他基元
使用常量(或整数)将不起作用。

$Color = new COM('ColorClass');
$Color->set_color_function($red, $green, $blue);

或者类似的东西会。

PHP can define the constants the COM exposes automatic.

set_ini('com.autoregister-typelib', true);

or by hand

com_load_typelib($typelib_name);

But if the OLE_COLOR is a object instead of an integer, string or other primitive
using constants (or integers) won't work.

$Color = new COM('ColorClass');
$Color->set_color_function($red, $green, $blue);

Or something similar will.

橪书 2024-07-14 20:23:30

当我从 PHP 调用 COM 函数时,我只是在调用中传递它们。 所以我的旧代码有:

$myComObject = new COM("MY_COM_OBJECT");
$myComObject->Myfunction( myVar1, myVar2, 'my string var');

When I've called COM functions from PHP, I just passed them in the call. So my old code has:

$myComObject = new COM("MY_COM_OBJECT");
$myComObject->Myfunction( myVar1, myVar2, 'my string var');
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文