PHPTS:一键免费搭建 Nginx + PHP + MySQL 运行环境

The DOTNET class

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

简介

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.

Note:

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

类摘要

DOTNET extends VARIANT {
/* 方法 */
__construct ( string $assembly_name , string $class_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

Example #1 DOTNET example

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

Table of Contents