这是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
我在通过regasm.exe放入DLL后尝试从PHP访问它。没有反应。
[编辑:现在运行它通过C:\ Program Files(x86)\ Microsoft SDKs \ Windows \ v7.0A \ Bin \ NETFX 4.0 Tools \ gacutil.exe我得到一个强名称失败,我'我正在努力。]
有没有人可以通过PHP 5访问一个.NET DLL的Hello世界样本(如果我没有弄错的话,“类库”的另一个词)?到目前为止,我是否正在使用这种方法?
这是怎么做到的?谢谢你的帮助。
这是PHP代码BTW:
<?php
$obj = new COM("ClassLibrary1.Class1");
$output=$obj->HelloWorld();
echo $output;
?>
答案 0 :(得分:0)
PHP在作为服务运行的Web服务器上运行是正常的 - 除非你已经跳过许多环节,这些无法与桌面交互,所以有你的MessageBox
无处可见。