繁体   English   中英

PHP、COM对象,出参数

[英]PHP, COM objects, and out parameters

我正在使用 PHP 与 COM object 一起使用,其中一个 ZD47C174ED277BDF06CFC72763AB7 函数参数是“706CFC72763AB7”参数。 PHP 如何与这些一起工作?

示例(ModifyParam 可以做任何事情,例如 output 当天的词或提供对象):

$MyCom = new COM("APPLib.APP");

$outParam;
//APP.ModifyParam(out object pParam)
$MyCom->ModifyParam($outParam);

var_dump($outParam); //NULL

该示例基于输出 object 数组或字符串数组的实际代码。 真正的代码并没有输出列表。

据我所知(如果我在这里错了,你可以纠正我) - [out]参数表示存储结果的变量。 所以如果你在COM object中有这个方法:

GetUserInfo([in] long machineID, [out] long* userID, [out] BSTR* userName)

[in]参数表示参数, [out]参数是将被写入的结果变量,就像MySQLi::bind_result()方法的工作方式一样。 使用上述方法的示例代码(假设 COM object 已正确设置):

$obj = new COM('Namespace.Class');

// This is the [in] parameter, the machine number we wanted to inspect.
$machineID = 1

// Define [out] variables with the correct type, according to the API.
$userID = 0;
$userName = '';

// Call the COM method.
$obj->GetUserInfo($machineID, $userID, $userName);

// Print the results.
echo "User ID: $userID<br />";
echo "User Name: $userName";

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM