(PHP 4 > 4.1.0, PHP 5, PHP 7, PHP 8)
com::__construct — com class constructor
$module_name
,$server_name
= null
,$codepage
= CP_ACP
,$typelib
= ""Constructs a new com object.
module_name
Word.Application
. A Class ID is the UUID that uniquely identifies a given class. A Moniker is a special form of naming, similar in concept to a URL scheme, that identifies a resource and specifies how it should be loaded. As an example, you could load up Word and get an object representing a word document by specifying the full path to the word document as the module name, or you can use LDAP:
as a moniker to use the ADSI interface to LDAP. server_name
null
, the object is run using the default for the application. The default is typically to run it on the local machine, although the administrator might have configured the application to launch on a different machine. If a non-null
value is specified for server, PHP will refuse to load the object unless the com.allow_dcomphp.ini option is set to true
. If server_name
is an array, it should contain the following elements (case sensitive!). Note that they are all optional (although you need to specify both Username and Password together); if you omit the Server setting, the default server will be used (as mentioned above), and the instantiation of the object will not be affected by the com.allow_dcomphp.ini directive.
key | type | description |
---|---|---|
Server | string | The name of the server. |
Username | string | The username to connect as. |
Password | string | The password for Username . |
Domain | string | The domain of server . |
Flags | integer | One or more of the following constants, logically OR'd together: CLSCTX_INPROC_SERVER , CLSCTX_INPROC_HANDLER , CLSCTX_LOCAL_SERVER , CLSCTX_REMOTE_SERVER , CLSCTX_SERVER and CLSCTX_ALL . The default value if not specified here is CLSCTX_SERVER if you also omit Server , or CLSCTX_REMOTE_SERVER if you do specify a server. You should consult the Microsoft documentation for CoCreateInstance for more information on the meaning of these constants; you will typically never have to use them. |
codepage
CP_ACP
(use system default ANSI code page - the default if this parameter is omitted), CP_MACCP
, CP_OEMCP
, CP_SYMBOL
, CP_THREAD_ACP
(use codepage/locale set for the current executing thread), CP_UTF7
and CP_UTF8
. You may also use the number for a given codepage; consult the Microsoft documentation for more details on codepages and their numeric values.