




| Resultats | com | Contact |
|
Manuel PHP
|
|
Table : ..NET Functions.Apache-specific Functions .Alternative PHP Cache .Advanced PHP debugger .Array Functions .Aspell functions [deprecated] .BBCode Functions .BCMath Arbitrary Precision Mathematics Functions .PHP bytecode Compiler .Bzip2 Compression Functions .Calendar Functions .CCVS API Functions [deprecated] .Class/Object Functions .Classkit Functions .ClibPDF Functions [deprecated] .COM and .Net (Windows) .Crack Functions .Character Type Functions .CURL, Client URL Library Functions .Cybercash Payment Functions .Credit Mutuel CyberMUT functions .Cyrus IMAP administration Functions .Date and Time Functions .DB++ Functions .Database (dbm-style) Abstraction Layer Functions .dBase Functions .DBM Functions [deprecated] .dbx Functions .Direct IO Functions .Directory Functions .DOM Functions .DOM XML Functions .enchant Functions .Error Handling and Logging Functions .Exif Functions .Expect Functions .File Alteration Monitor Functions .Forms Data Format Functions .Fileinfo Functions .filePro Functions .Filesystem Functions .Filter Functions .Firebird/InterBase Functions .Firebird/Interbase Functions (PDO FIREBIRD) .FriBiDi Functions .FrontBase Functions .FTP Functions .Function Handling Functions .GeoIP Functions .Gettext Functions .GMP Functions .gnupg Functions .Net Gopher .Haru PDF Functions .hash Functions .HTTP .Hyperwave Functions .Hyperwave API Functions .i18n Functions .IBM Functions (PDO IBM) .IBM DB2, Cloudscape and Apache Derby Functions .iconv Functions .ID3 Functions .IIS Administration Functions .Image Functions .Imagick Image Library .IMAP, POP3 and NNTP Functions .Informix Functions .Informix Functions (PDO INFORMIX) .Ingres II Functions .IRC Gateway Functions .PHP / Java Integration .JSON Functions .KADM5 .LDAP Functions .libxml Functions .Lotus Notes Functions .LZF Functions .Mail Functions .Mailparse Functions .Mathematical Functions .MaxDB PHP Extension .MCAL Functions .Mcrypt Encryption Functions .MCVE (Monetra) Payment Functions .Memcache Functions .Mhash Functions .Mimetype Functions .Ming functions for Flash .Miscellaneous Functions .mnoGoSearch Functions .Microsoft SQL Server Functions .Microsoft SQL Server and Sybase Functions (PDO DBLIB) .Mohawk Software Session Handler Functions .mSQL Functions .Multibyte String Functions .muscat Functions .MySQL Functions .MySQL Functions (PDO MYSQL) .MySQL Improved Extension .Ncurses Terminal Screen Control Functions .Network Functions .Newt Functions .NSAPI-specific Functions .Object Aggregation/Composition Functions .Object property and method call overloading .Oracle Functions .ODBC Functions (Unified) .ODBC and DB2 Functions (PDO ODBC) .oggvorbis .OpenAL Audio Bindings .OpenSSL Functions .Oracle Functions [deprecated] .Oracle Functions (PDO OCI) .Output Control Functions .Ovrimos SQL Functions .Paradox File Access .Parsekit Functions .Process Control Functions .Regular Expression Functions (Perl-Compatible) .PDF Functions .PDO Functions .Phar archive stream and classes .PHP Options&Information .POSIX Functions .Regular Expression Functions (POSIX Extended) .PostgreSQL Functions .PostgreSQL Functions (PDO PGSQL) .Printer Functions .Program Execution Functions .PostScript document creation .Pspell Functions .qtdom Functions .Radius .Rar Functions .GNU Readline .GNU Recode Functions .RPM Header Reading Functions .runkit Functions .SAM - Simple Asynchronous Messaging .Satellite CORBA client extension [deprecated] .SCA Functions .SDO Functions .SDO XML Data Access Service Functions .SDO Relational Data Access Service Functions .Semaphore, Shared Memory and IPC Functions .SESAM Database Functions .PostgreSQL Session Save Handler .Session Handling Functions .Shared Memory Functions .SimpleXML functions .SNMP Functions .SOAP Functions .Socket Functions .Standard PHP Library (SPL) Functions .SQLite Functions .SQLite Functions (PDO SQLITE) .Secure Shell2 Functions .Statistics Functions .Stream Functions .String Functions .Subversion Functions .Shockwave Flash Functions .Swish Functions .Sybase Functions .TCP Wrappers Functions .Tidy Functions .Tokenizer Functions .Unicode Functions .URL Functions .Variable Handling Functions .Verisign Payflow Pro Functions .vpopmail Functions .W32api Functions .WDDX Functions .win32ps Functions .win32service Functions .xattr Functions .xdiff Functions .XML Parser Functions .XML-RPC Functions .XMLReader functions .XMLWriter Functions .XSL functions .XSLT Functions .YAZ Functions .YP/NIS Functions .Zip File Functions .Zlib Compression Functions |
comCOM and .Net (Windows)IntroductionCOM is an acronym for Component Object Model; it is an object orientated layer (and associated services) on top of DCE RPC (an open standard) and defines a common calling convention that enables code written in any language to call and interoperate with code written in any other language (provided those languages are COM aware). Not only can the code be written in any language, but it need not even be part of the same executable; the code can be loaded from a DLL, be found in another process running on the same machine, or, with DCOM (Distributed COM), be found in another process on a remote machine, all without your code even needing to know where a component resides. There is a subset of COM known as OLE Automation which comprises a set of COM interfaces that allow loose binding to COM objects, so that they can be introspected and called at run-time without compile-time knowledge of how the object works. The PHP COM extension utilizes the OLE Automation interfaces to allow you to create and call compatible objects from your scripts. Technically speaking, this should really be called the "OLE Automation Extension for PHP", since not all COM objects are OLE compatible. Now, why would or should you use COM? COM is one of the main ways to glue applications and components together on the Windows platform; using COM you can launch Microsoft Word, fill in a document template and save the result as a Word document and send it to a visitor of your web site. You can also use COM to perform administrative tasks for your network and to configure your IIS; these are just the most common uses; you can do much more with COM. Starting with PHP 5, this extension (and this documentation) was rewritten from scratch and much of the old confusing and bogus cruft has be removed. Additionally, we support the instantiation and creation of .Net assemblies using the COM interoperability layer provided by Microsoft. Please read » this article for an overview of the changes in this extension in PHP 5. RequirementsCOM functions are only available for the Windows version of PHP. .Net support requires PHP 5 and the .Net runtime. InstallationThere is no installation needed to use these functions; they are part of the PHP core. The windows version of PHP has built in support for this extension. You do not need to load any additional extension in order to use these functions. You are responsible for installing support for the various COM objects that you intend to use (such as MS Word); we don't and can't bundle all of those with PHP. For EachStarting with PHP 5, you may use PHP's own foreach statement to iterate over the contents of a standard COM/OLE IEnumVariant. In laymans terms, this means that you can use foreach in places where you would have used For Each in VB/ASP code.
Example#1 For Each in ASP
<%
Set domainObject = GetObject("WinNT://Domain")
For Each obj in domainObject
Response.Write obj.Name & "<br />"
Next
%>
Example#2 while() ... Next() in PHP 4
<?php
Example#3 foreach in PHP 5
<?php Arrays and Array-style COM propertiesMany COM objects expose their properties as arrays, or using array-style access. In PHP 4, you may use PHP array syntax to read/write such a property, but only a single dimension is allowed. If you want to read a multi-dimensional property, you could instead make the property access into a function call, with each parameter representing each dimension of the array access, but there is no way to write to such a property. PHP 5 introduces the following new features to make your life easier:
Exceptions (PHP 5)This extension will throw instances of the class com_exception whenever there is a potentially fatal error reported by COM. All COM exceptions have a well-defined code property that corresponds to the HRESULT return value from the various COM operations. You may use this code to make programmatic decisions on how to handle the exception. Runtime ConfigurationThe behaviour of these functions is affected by settings in php.ini.
Here's a short explanation of the configuration directives.
Resource TypesThis extension defines a reference to a COM component returned by deprecated com_load() (this function does not exist in PHP 5; use the COM class instead). Predefined ConstantsThe constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime.
See AlsoFor further information on COM read the » COM specification or perhaps take a look at Don Box's » Yet Another COM Library (YACL). You might find some additional useful information in our FAQ for PHP and COM. If you're thinking of using MS Office applications on the server side, you should read the information here: » Considerations for Server-Side Automation of Office. Table of Contents
|


PHP 手册