这是 AssemblyInfo.vb:
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("ClassLibrary1")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("ClassLibrary1")>
<Assembly: AssemblyCopyright("Copyright © 2012")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(True)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("bd484c72-e166-4480-a1fd-71ab12e09e25")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
这是课程:
Public Class Class1
Public Sub HelloWorld()
MsgBox("hello, world")
End Sub
End Class
在将 DLL 通过 regasm.exe 后,我尝试从 PHP 访问它。没有反应。
[编辑:现在通过 C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\gacutil.exe 运行它后,我遇到了一个强名称错误,我正在处理现在。]
有没有人有我可以通过 PHP 5 访问的 .NET DLL 的 Hello world 示例(如果我没记错的话,“类库”的另一个词)?到目前为止,我是否在使用这种方法的正确道路上?
这是怎么做到的?谢谢你的帮助。
这是PHP代码顺便说一句:
<?php
$obj = new COM("ClassLibrary1.Class1");
$output=$obj->HelloWorld();
echo $output;
?>