簡體   English   中英

Hello world VB.NET類庫,從PHP調用

[英]Hello world VB.NET class library, called from PHP

這是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 world示例(如果我沒記錯的話,是“類庫”的另一個詞)? 到目前為止,我是否在使用這種方法的正確道路上?

怎么做? 謝謝你的幫助。

這是PHP代碼BTW:

<?php
 $obj = new COM("ClassLibrary1.Class1");
 $output=$obj->HelloWorld();
 echo $output;
?>

PHP在作為服務運行的Web服務器上運行是正常的-除非您跳了很多圈,否則它們無法與桌面交互 ,因此MessageBox無處可顯示。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM