您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

如何用PHP调用自己编写的COM组件?

2024/2/28 3:51:50发布16次查看
首先写activex dll:
新建一个vb6工程,activex dll将工程命名为p_test,类名为c_test ,类的文件内容如下:
option explicitprivate myscriptingcontext as scriptingcontextprivate myapplication as applicationprivate myrequest as request private myresponse as responseprivate myserver as serverprivate mysession as session publicsub onstartpage(passedscriptingcontext as scriptingcontext)set myscriptingcontext = passedscriptingcontextset myapplication = myscriptingcontext.applicationset myrequest = myscriptingcontext.requestset myresponse = myscriptingcontext.responseset myserver = myscriptingcontext.serverset mysession = myscriptingcontext.sessionend subpublic sub onendpage()set myscriptingcontext = nothingset myapplication = nothingset myrequest = nothingset myresponse = nothingset myserver = nothingset mysession = nothingend subpublic function test_number(num) as variantif num 0 then get_number_attrib = 1if num = 0 then get_number_attrib = 0end function
编译生成p_test.dll文件
注册
提示符下运行:regsvr32 p_test.dll
编写php文件,test.php4代码如下:
test_number(-454);echo $a;?>
可能碰到的问题是,编译工程时通不过,要将microsoft active server pages object library引用进来,具体实现project->references找到改库,并勾上 。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product