Manuál PHP | ||
---|---|---|
Předcházející | Další |
XV. Funkce na podporu COM ve Windows
Úvod
COM je technologie, která umožňuje znovupoužít kód napsaný v jakémkoliv jazyce za použití standardního volání a schováním implementačních detailů - jako na kterém počítači je komponenta uložena a který spustitelný soubor ji uchovává - za API. Lze si to představit jako rozšířený mechanismus vzdáleného volání procedur (RPC) se základy objektů. COM odděluje implementaci od rozhraní.
COM podporuje verzování, oddělení implementace od rozhraní a skrytí implementačních detailů jako je umístění spustitelného souboru a jazyku, který byl použit.
Požadavky
Tyto funkce jsou dostupné pouze ve Windows verzi PHP.
Instalace
K používání těchto funkcí není třeba žádná instalace, jsou součástí jádra PHP.
Verze PHP pro Windows má vestavěnou podporu pro toto rozšíření. K použití těchto funkcí není třeba načítat žádná další rozšíření.
Konfigurace běhu
Chování těchto funkcí je ovlivněno nastavením parametrů v php.ini.
Tabulka 1. Com configuration options
Name | Default | Changeable | Changelog |
---|---|---|---|
com.allow_dcom | "0" | PHP_INI_SYSTEM | Available since PHP 4.0.5. |
com.autoregister_typelib | "0" | PHP_INI_ALL | PHP_INI_SYSTEM in PHP 4. Available since PHP 4.1.0. |
com.autoregister_verbose | "0" | PHP_INI_ALL | PHP_INI_SYSTEM in PHP 4. Available since PHP 4.1.0. |
com.autoregister_casesensitive | "1" | PHP_INI_ALL | PHP_INI_SYSTEM in PHP 4. Available since PHP 4.1.0. |
com.code_page | "" | PHP_INI_ALL | Available since PHP 5.0.0. |
com.typelib_file | "" | PHP_INI_SYSTEM | Available since PHP 4.0.5. |
Zde je stručný popis konfiguračních direktiv.
com.allow_dcom
When this is turned on, PHP will be allowed to operate as a D-COM (Distributed COM) client and will allow the PHP script to instantiate COM objects on a remote server.
com.autoregister_typelib
When this is turned on, PHP will attempt to register constants from the typelibrary of objects that it instantiates, if those objects implement the interfaces required to obtain that information. The case sensitivity of the constants it registers is controlled by the
com.autoregister_casesensitive
configuration directive.com.autoregister_verbose
When this is turned on, any problems with loading a typelibrary during object instantiation will be reported using the PHP error mechanism. The default is off, which does not emit any indication if there was an error finding or loading the type library.
com.autoregister_casesensitive
When this is turned on (the default), constants found in auto-loaded type libraries will be registered case sensitively. See com_load_typelib() for more details.
com.code_page
It controls the default character set code-page to use when passing strings to and from COM objects. If set to an empty string, PHP will assume that you want CP_ACP, which is the default system ANSI code page.
If the text in your scripts is encoded using a different encoding/character set by default, setting this directive will save you from having to pass the code page as a parameter to the COM class constructor. Please note that by using this directive (as with any PHP configuration directive), your PHP script becomes less portable; you should use the COM constructor parameter whenever possible.
Poznámka: This configuration directive was introduced with PHP 5.
com.typelib_file
When set, this should hold the path to a file that contains a list of typelibraries that should be loaded on startup. Each line of the file will be treated as the type library name and loaded as though you had called com_load_typelib(). The constants will be registered persistently, so that the library only needs to be loaded once. If a type library name ends with the string #cis or #case_insensitive, then the constants from that library will be registered case insensitively.
Předdefinované konstanty
Tyto konstanty jsou definovány tímto rozšířením a budou k dispozici pouze tehdy, bylo-li rozšíření zkompilováno společně s PHP nebo dynamicky zavedeno za běhu.
- CLSCTX_INPROC_SERVER (integer)
- CLSCTX_INPROC_HANDLER (integer)
- CLSCTX_LOCAL_SERVER (integer)
- CLSCTX_REMOTE_SERVER (integer)
- CLSCTX_SERVER (integer)
- CLSCTX_ALL (integer)
- VT_NULL (integer)
- VT_EMPTY (integer)
- VT_UI1 (integer)
- VT_I2 (integer)
- VT_I4 (integer)
- VT_R4 (integer)
- VT_R8 (integer)
- VT_BOOL (integer)
- VT_ERROR (integer)
- VT_CY (integer)
- VT_DATE (integer)
- VT_BSTR (integer)
- VT_DECIMAL (integer)
- VT_UNKNOWN (integer)
- VT_DISPATCH (integer)
- VT_VARIANT (integer)
- VT_I1 (integer)
- VT_UI2 (integer)
- VT_UI4 (integer)
- VT_INT (integer)
- VT_UINT (integer)
- VT_ARRAY (integer)
- VT_BYREF (integer)
- CP_ACP (integer)
- CP_MACCP (integer)
- CP_OEMCP (integer)
- CP_UTF7 (integer)
- CP_UTF8 (integer)
- CP_SYMBOL (integer)
- CP_THREAD_ACP (integer)
- VARCMP_LT (integer)
- VARCMP_EQ (integer)
- VARCMP_GT (integer)
- VARCMP_NULL (integer)
- NORM_IGNORECASE (integer)
- NORM_IGNORENONSPACE (integer)
- NORM_IGNORESYMBOLS (integer)
- NORM_IGNOREWIDTH (integer)
- NORM_IGNOREKANATYPE (integer)
- NORM_IGNOREKASHIDA (integer)
- DISP_E_DIVBYZERO (integer)
- DISP_E_OVERFLOW (integer)
- MK_E_UNAVAILABLE (integer)
Viz také
Více informací o COM naleznete ve specifikaci COM nebo se třeba podívejte na Yet Another COM Library (YACL) Dona Boxe.
- Obsah
- COM -- COM class
- DOTNET -- DOTNET class
- VARIANT -- VARIANT class
- com_addref -- Increases the components reference counter [deprecated]
- com_create_guid -- Generate a globally unique identifier (GUID)
- com_event_sink -- Connect events from a COM object to a PHP object
- com_get_active_object -- Returns a handle to an already running instance of a COM object
- com_get -- Získává hodnotu vlastnosti COM komponenty
- com_invoke -- Volá metodu COM komponenty.
- com_isenum -- Indicates if a COM object has an IEnumVariant interface for iteration [deprecated]
- com_load_typelib -- Loads a Typelib
- com_load -- Vytvoří nový odkaz na COM komponentu
- com_message_pump -- Process COM messages, sleeping for up to timeoutms milliseconds
- com_print_typeinfo -- Print out a PHP class definition for a dispatchable interface
- com_propget -- Získává hodnotu vlastnosti COM komponenty
- com_propput -- Přiřazuje hodnotu vlastnosti COM komponenty.
- com_propset -- Přiřazuje hodnotu vlastnosti COM komponenty.
- com_release -- Decreases the components reference counter [deprecated]
- com_set -- Přiřazuje hodnotu vlastnosti COM komponenty.
- variant_abs -- Returns the absolute value of a variant
- variant_add -- "Adds" two variant values together and returns the result
- variant_and -- performs a bitwise AND operation between two variants and returns the result
- variant_cast -- Convert a variant into a new variant object of another type
- variant_cat -- concatenates two variant values together and returns the result
- variant_cmp -- Compares two variants
- variant_date_from_timestamp -- Returns a variant date representation of a Unix timestamp
- variant_date_to_timestamp -- Converts a variant date/time value to Unix timestamp
- variant_div -- Returns the result from dividing two variants
- variant_eqv -- Performs a bitwise equivalence on two variants
- variant_fix -- Returns the integer portion ? of a variant
- variant_get_type -- Returns the type of a variant object
- variant_idiv -- Converts variants to integers and then returns the result from dividing them
- variant_imp -- Performs a bitwise implication on two variants
- variant_int -- Returns the integer portion of a variant
- variant_mod -- Divides two variants and returns only the remainder
- variant_mul -- multiplies the values of the two variants and returns the result
- variant_neg -- Performs logical negation on a variant
- variant_not -- Performs bitwise not negation on a variant
- variant_or -- Performs a logical disjunction on two variants
- variant_pow -- Returns the result of performing the power function with two variants
- variant_round -- Rounds a variant to the specified number of decimal places
- variant_set_type -- Convert a variant into another type "in-place"
- variant_set -- Assigns a new value for a variant object
- variant_sub -- subtracts the value of the right variant from the left variant value and returns the result
- variant_xor -- Performs a logical exclusion on two variants
Předcházející | Domů | Další |
cpdf_translate | Nahoru |