这是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我遇到了一个强大的名称失败,我现在正在努力。
有没有人有一个基本的,你好世界 .NET DLL 示例(如果我没记错的话,"类库"的另一个词)我可以通过 PHP 5 访问? 到目前为止,我使用这种方法的正确方法吗?
这是怎么做到的? 感谢您的任何帮助。
这是PHP代码顺便说一句:
<?php
$obj = new COM("ClassLibrary1.Class1");
$output=$obj->HelloWorld();
echo $output;
?>
PHP 在作为服务运行的 Web 服务器上运行是正常的——除非你跳过了很多箍,否则这些都无法与桌面交互,所以你的MessageBox
无处可显示。