PHP的COM对象方法
COM object method for PHP
我正在开发将加密传递的字符串的COM对象。它将从PHP调用。我不知道我怎么能从COM返回值到PHP。我尝试了下面的代码,也许它不工作。
STDMETHODIMP CATLObject::EncryptURL(VARIANT* sURLString, VARIANT* sEncryptedValue)
{
URLEncryption oURLEncryption;
char sRequestString[MAX_NAME] = "abcbbefekjdss dsf dsk fkjds fk sd";
char sEncrytedRequestStrin
g[MAX_NAME] = "";
char sDecrytedRequestString[MAX_NAME] = "";
oURLEncryption.EncryptQuery(sRequestString, sEncrytedRequestString);
KeyValue oKeyValue1;
KeyValue oParameterKeyValue;
oKeyValue1.ParseKeyValueString(sEncrytedRequestString, '&', true);
string sParameter = oKeyValue1.GetValue("sp");
string sCheckSum = oKeyValue1.GetValue("chk");
oURLEncryption.DecryptQuery(sParameter, sCheckSum, (void *)&oParameterKeyValue);
string sCidAudio = oParameterKeyValue.GetValue("cid_audio");
string sEUid = oParameterKeyValue.GetValue("euid");
printf("sCidAudio = %sn", sCidAudio.c_str());
printf("sEUid = %snn", sEUid.c_str());
// Create an instance of the MEMORYSTATUSEX structure
MEMORYSTATUSEX memstatex;
// Specify the length of the structure
memstatex.dwLength = sizeof(memstatex);
// Call the GlobalMemoryStatusEx function and pass to it
// a reference to our MEMORYSTATUSEX instance
::GlobalMemoryStatusEx(&memstatex);
// Set the ulVal (unsigned long value) of the VARIANT parameter
// passed by reference to the function with the dwMemoryLoad
// value of the MEMORYSTATUEX instance which specifies the
// approximate percentage of the physical memory currently
// in use.
sURLString->ulVal = memstatex.dwMemoryLoad;
sEncryptedValue->bstrVal = L"Output from DLL!!!";
return S_OK;
}
从PHP我正在尝试以下方式获得返回值
$testConnection = new COM("URLEncryption.ATLObject");
$sURLString = new VARIANT(0, VT_UI4);
$sEncryptedValue = new VARIANT(0, VT_UI4);
$testConnection->EncryptURL($sURLString,$sEncryptedValue);
在我看来这是一个愚蠢的打字错误:
new COM("URLEncryption.ATLObject")
相比STDMETHODIMP CATLObject::EncryptURL
^^^
我想说new COM
应该改为:
$testConnection = new COM("URLEncryption.CATLObject");
相关文章:
- 使用std::函数映射对象方法
- C++优先级队列,按对象的唯一指针的特定方法升序排列
- 按对象的特定方法按升序排列的C++优先级队列
- 有没有一种方法可以使用placement new将堆叠对象分配给分配的内存
- 从父类方法返回子类对象
- 在他自己的方法中,有可能将一个对象取消引用到另一个对象吗
- 为什么此派生对象无法访问基类的后递减方法?
- c++, 在子类中,如何在没有对象的情况下访问父类的方法?
- 正在调用shared_ptr对象方法
- 将方法转换为调用该方法的成员函子对象会导致崩溃
- 检查哪个对象调用了另一个对象的对象方法
- CPU 瓶颈;处理具有许多非静态对象的 3D 场景渲染的简单方法
- 直接在 unordered_map 的方法中使用哈希,而不是生成哈希的用户定义对象
- 没有取消引用/解包对象的标准方法?
- 使用 gmock c++ 在真实对象上调用方法
- 当我调用对象的方法时,对象的成员会发生变化
- 根据对象类调用不同的方法
- 如何在C++中循环访问未知对象方法?
- 使用动态实例化的对象填充矢量的快速方法
- 对类中的对象使用方法