First write ActiveX Dll:
Create a VB6 project. ActiveX Dll name the project P_test and the class name c_test. The file content of the class is 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 = 1
If num = 0 Then Get_Number_Attrib = 0
End Function
Compile and generate the p_test.dll File
Register
Run: regsvr32 p_test.dll
Compile the PHP file. The Code test. php4 is as follows: <?
$ B = new COM ("p_test.c_test ");
$ A = $ B-> Test_Number (-454 );
Echo $;
?>
The possible problem is that Microsoft Active Server Pages Object Library
Reference. Find and check the library for the specific implementation of "Project-> References.