Hello world VB.NET类库,从PHP调用
下面是AssemblyInfo.vb:Hello world VB.NET类库,从PHP调用,php,.net,vb.net,com,com-interop,Php,.net,Vb.net,Com,Com Interop,下面是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 informa
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")>
在将DLL放入regasm.exe之后,我尝试从PHP访问它。没有回应
[编辑:现在通过C:\Program Files(x86)\Microsoft SDK\Windows\v7.0A\Bin\NETFX 4.0 Tools\gacutil.exe运行后,我遇到了一个强名称故障,我正在处理该故障。]
有没有人有一个我可以通过PHP5访问的.NETDLL(如果我没弄错的话,是“类库”的另一个词)的简单的HelloWorld示例?到目前为止,我的方法是否正确
这是怎么做到的?谢谢你的帮助
这是PHP代码,顺便说一句:
<?php
$obj = new COM("ClassLibrary1.Class1");
$output=$obj->HelloWorld();
echo $output;
?>
PHP在作为服务运行的web服务器上运行是正常的——除非您经历了许多困难,否则这些无法与桌面交互,因此,您的MessageBox
无处可显示。PHP在作为服务运行的web服务器上运行是正常的——除非您经历了许多困难,否则这些无法与桌面交互,因此您的MessageBox
无处可显示。为什么要使用COM?为什么不是DOTNET呢?如果你在文章的底部谈论我的PHP代码,谢谢!这看起来是错误的(不是吗?),而且在我开始将一开始的COM作业更多地转向.NET解决方案之后,我从未重新考虑过这一点。你是说应该是DOTNET()?我楼上的其他代码呢,可以吗,还是应该有所不同?谢谢您的指导。是的,我不是COM程序集方面的专家,但在我看来,既然您有一个.NET项目,您可以尝试使用DOTNET
加载.NET程序集。谢谢我们会继续努力。为什么要使用COM?为什么不是DOTNET呢?如果你在文章的底部谈论我的PHP代码,谢谢!这看起来是错误的(不是吗?),而且在我开始将一开始的COM作业更多地转向.NET解决方案之后,我从未重新考虑过这一点。你是说应该是DOTNET()?我楼上的其他代码呢,可以吗,还是应该有所不同?谢谢您的指导。是的,我不是COM程序集方面的专家,但在我看来,既然您有一个.NET项目,您可以尝试使用DOTNET
加载.NET程序集。谢谢我会继续努力的。
<?php
$obj = new COM("ClassLibrary1.Class1");
$output=$obj->HelloWorld();
echo $output;
?>