簡體   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