The dotnet class

(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)

Einführung

The dotnet class allows you to instantiate a class from a .Net assembly and call its methods and access its properties, if the class and the methods and properties are » visible to COM.

Neither instantiating static classes nor calling static methods is supported. Instantiating generic classes such as System.Collections.Generic.List is not supported either.

Some .Net classes do not implement IDispatch, so while they can be instantiated, calling methods or accessing properties on these classes is not supported.

Hinweis:

You need to install the .Net runtime on your web server to take advantage of this feature.

Hinweis:

Prior to PHP 8.0.0, .Net framework 4.0 and later were not supported by the dotnet class. If assemblies had been registered with regasm.exe, the classes could be instantiated as com objects, though. As of PHP 8.0.0, .Net framework 4.0 and later are supported via the php.ini directive com.dotnet_version.

Klassenbeschreibung

class dotnet extends variant {
/* Methoden */
public __construct(string $assembly_name, string $datatype_name, int $codepage = CP_ACP)
}

Overloaded Methods

The returned object is an overloaded object, which means that PHP does not see any fixed methods as it does with regular classes; instead, any property or method accesses are passed through to COM and from there to DOTNET. In other words, the .Net object is mapped through the COM interoperability layer provided by the .Net runtime.

Once you have created a dotnet object, PHP treats it identically to any other COM object; all the same rules apply.

dotnet examples

Beispiel #1 dotnet example

<?php
$stack 
= new dotnet("mscorlib""System.Collections.Stack");
$stack->Push(".Net");
$stack->Push("Hello ");
echo 
$stack->Pop() . $stack->Pop();
?>

Inhaltsverzeichnis

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

Neuigkeiten für PHP-Entwickler: Laravel 11 Veröffentlichung

Am 12. März 2024 wurde die lang erwartete Version 11 des Laravel-Frameworks veröffentlicht, die eine Reihe von spannenden Neuerungen und Verbesserungen für die PHP-Entwicklungsgemeinschaft mit sich bringt. ...

Mike94

Autor : Mike94
Kategorie: PHP Magazin

Technisches SEO bleibt relevant

Technisches SEO – Was ist das überhaupt? Technisches SEO bezieht sich auf die Optimierung der technischen Aspekte deiner Webseite. Das Ziel ist klar! ...

admin

Autor : admin
Kategorie: SEO & Online-Marketing

Was ist neu in der PHP 8.2.10

PHP 8.2.10 ist eine der neuesten Versionen von PHP, die eine Reihe von Verbesserungen und neuen Funktionen mit sich bringt. In diesem Artikel werden wir einige der herausragenden Neuerungen und Verbesserungen dieser Version diskutieren. ...

admin

Autor : admin
Kategorie: Software-Updates

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

PHP Java Android brauche Script

Als ich mich an reise nach tschernobyl buchen​ wandte (https://tschernobylreise.de/), war ich von der Organisation und dem Service angenehm übe ...

Geschrieben von pavloviktor am 28.03.2024 10:58:33
Forum: Projekthilfe
Seltsames Verhalten von execute() oder Fehler meinerseits

Hallo liebe Community, ich habe ein kleines Problem und vielleicht kann mir ja jemand helfen, würde ich mich sehr drüber freuen. Unten steht e ...

Geschrieben von garibaldiwz am 22.03.2024 13:03:12
Forum: SQL / Datenbanken
Google reCAPTCHA in Kontaktformular einbinden

Überprüfen Sie den E-Mail-Versand: Stellen Sie sicher, dass die E-Mail-Funktion mail() ordnungsgemäß funktioniert und dass keine Fehler beim V ...

Geschrieben von Gast am 18.03.2024 04:54:16
Forum: PHP Developer Forum
`count.php`

Hallo cober93327, und Danke fuer deine Antwort! :-) Naja, so einen "Besucherzähler" auf der Webseite anzuzeigen ist schon eher etwas, das man a ...

Geschrieben von kekse1 am 17.03.2024 15:56:38
Forum: Projekthilfe