怀疑.NET代码中的.NET dll文件 [英] Doubt in in php code for .NET dll file

查看:95
本文介绍了怀疑.NET代码中的.NET dll文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了dll,名称是MyDll.dll。 dll包含以下代码,

I created dll, the name is "MyDll.dll". The dll consist the below code,

namespace MyDll
{
    public class TestIndex
    {

        public string Sathish(string a)
        {
            a += "..This is .Net";
            return a;
        }
    }
}
<pre>
and then i registered the dll in assembly

 My php file name is Test.php and it should Contain below coding, 
<pre lang="PHP">
<?php
$test = new DOTNET("MyDll,Version=1.0.0.0,Culture=neutral,PublicKeyToken=0baa6d3271b1f300","MyDll.TestIndex");

echo($test->Sathish("From Php.."));

?>





我的预期结果是从Php ....这是.Net,但我得到以下错误




my expected result is "From Php....This is .Net", but i got below error

Fatal error: Uncaught exception 'com_exception' with message 'Failed to instantiate .Net object [Unwrapped, QI for IDispatch] [0x80004002] No such interface supported ' in C:\xampp\htdocs\Test.php:2 Stack trace: #0 C:\xampp\htdocs\Test.php(2): dotnet->dotnet('MyDll,Version=...', 'MyDll.TestInde...') #1 {main} thrown in C:\xampp\htdocs\Test.php on line 2





请帮助我......

谢谢你....

推荐答案

test = new DOTNET( MyDll,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = 0baa6d3271b1f300 MyDll.TestIndex);

echo(
test = new DOTNET("MyDll,Version=1.0.0.0,Culture=neutral,PublicKeyToken=0baa6d3271b1f300","MyDll.TestIndex"); echo(


test-> Sathish( 来自Php ..));

>
test->Sathish("From Php..")); ?>





我的预期结果是从Php ....这是.Net,但我得到以下错误




my expected result is "From Php....This is .Net", but i got below error

Fatal error: Uncaught exception 'com_exception' with message 'Failed to instantiate .Net object [Unwrapped, QI for IDispatch] [0x80004002] No such interface supported ' in C:\xampp\htdocs\Test.php:2 Stack trace: #0 C:\xampp\htdocs\Test.php(2): dotnet->dotnet('MyDll,Version=...', 'MyDll.TestInde...') #1 {main} thrown in C:\xampp\htdocs\Test.php on line 2





请帮助我......

谢谢你....


using System.Runtime.InteropServices; // Name Space

namespace MyDll
{
    [ComVisible(true)]     // using ComVisible only we can access the dll
    public class TestIndex
    {
 
        public string Sathish(string a)
        {
            a += "..This is .Net";
            return a;
        }
    }
}



结果是From Php ....这是.Net。


The result is "From Php....This is .Net".


这篇关于怀疑.NET代码中的.NET dll文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆