To write an ActiveX Dll first:
To create a new VB6 project, the ActiveX DLL names the project P_test, the class name is C_test, and the file contents of the class are as follows:
Option Explicit
Private Myscriptingcontext as ScriptingContext
Private MyApplication as Application
Private myrequest as Request private myresponse as Response
Private MyServer as Server
Private MySession as session public
Sub OnStartPage (Passedscriptingcontext as ScriptingContext)
Set Myscriptingcontext = Passedscriptingcontext
Set MyApplication = myscriptingcontext.application
Set myrequest = myscriptingcontext.request
Set Myresponse = Myscriptingcontext.response
Set MyServer = Myscriptingcontext.server
Set mysession = myscriptingcontext.session
End Sub
Public Sub OnEndPage ()
Set Myscriptingcontext = Nothing
Set MyApplication = Nothing
Set myrequest = Nothing
Set Myresponse = Nothing
Set MyServer = Nothing
Set mysession = Nothing
End Sub
Public Function test_number (num) as Variant
If num 0 Then get_number_attrib = 1
If num = 0 Then get_number_attrib = 0
End Function
Compiling the build P_test.dll file
Registered
Prompt to run: regsvr32 p_test.dll
Write PHP file, TEST.PHP4 code as follows:
<?php
$b =new COM ("P_test.c_test");
$a = $b->test_number (-454);
echo $a;
?>
The problem that may be encountered is that when compiling the project, the Microsoft Active Server Pages Object Library Reference is implemented to implement "project->references" to find the library and hook up.