<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >DOTNET</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="PHP 手册" HREF="index.html"><LINK REL="UP" TITLE="COM 和 .Net(Windows)函数" HREF="ref.com.html"><LINK REL="PREVIOUS" TITLE="COM" HREF="class.com.html"><LINK REL="NEXT" TITLE="VARIANT" HREF="class.variant.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP 手册</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="class.com.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="class.variant.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="class.dotnet" ></A >DOTNET</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN21919" ></A ><P > (no version information, might be only in CVS)</P >DOTNET -- DOTNET class</DIV ><DIV CLASS="refsynopsisdiv" ><A NAME="AEN21922" ></A ><H2 >大纲</H2 ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="synopsis" >$obj = new DOTNET("assembly", "classname")</PRE ></TD ></TR ></TABLE ></DIV ><DIV CLASS="refsect1" ><A NAME="class.dotnet.class" ></A ><H2 >Description</H2 ><P > The DOTNET class allows you to instantiate a class from a .Net assembly and call its methods and access its properties. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="class.dotnet.constructor" ></A ><H2 >Methods</H2 >string <B CLASS="methodname" >DOTNET::DOTNET</B > ( string assembly_name, string class_name [, int codepage] )<BR ></BR ><P > DOTNET class constructor. <CODE CLASS="parameter" >assembly_name</CODE > specifies which assembly should be loaded, and <CODE CLASS="parameter" >class_name</CODE > specifices which class in that assembly to instantiate. You may optionally specify a <CODE CLASS="parameter" >codepage</CODE > to use for unicode string transformations; see the <A HREF="class.com.html" >COM</A > class for more details on code pages. </P ><P > 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. </P ><P > Once you have created a DOTNET object, PHP treats it identically to any other COM object; all the same rules apply. </P ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="example.dotnet" ></A ><P ><B >例 1. DOTNET example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /> $stack </font><font color="#007700">= new </font><font color="#0000BB">DOTNET</font><font color="#007700">(</font><font color="#DD0000">"mscorlib"</font><font color="#007700">, </font><font color="#DD0000">"System.Collections.Stack"</font><font color="#007700">); <br /> </font><font color="#0000BB">$stack</font><font color="#007700">-></font><font color="#0000BB">Push</font><font color="#007700">(</font><font color="#DD0000">".Net"</font><font color="#007700">); <br /> </font><font color="#0000BB">$stack</font><font color="#007700">-></font><font color="#0000BB">Push</font><font color="#007700">(</font><font color="#DD0000">"Hello "</font><font color="#007700">); <br /> echo </font><font color="#0000BB">$stack</font><font color="#007700">-></font><font color="#0000BB">Pop</font><font color="#007700">() . </font><font color="#0000BB">$stack</font><font color="#007700">-></font><font color="#0000BB">Pop</font><font color="#007700">(); <br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >注意: </B > You need to install the .Net runtime on your web server to take advantage of this feature. </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="class.com.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >起始页</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="class.variant.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >COM</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.com.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >VARIANT</TD ></TR ></TABLE ></DIV ></BODY ></HTML >