International PHP Conference Berlin 2023

运行时配置

这些函数的行为受 php.ini 中的设置影响。

COM 配置选项
名字 默认 可修改范围 更新日志
com.allow_dcom "0" PHP_INI_SYSTEM  
com.autoregister_typelib "0" PHP_INI_ALL  
com.autoregister_verbose "0" PHP_INI_ALL  
com.autoregister_casesensitive "1" PHP_INI_ALL  
com.code_page "" PHP_INI_ALL  
com.dotnet_version "" PHP_INI_SYSTEM As of PHP 8.0.0
com.typelib_file "" PHP_INI_SYSTEM  
有关 PHP_INI_* 样式的更多详情与定义,见 配置可被设定范围

这是配置指令的简短说明。

com.allow_dcom

启用后,将允许 PHP 作为 D-COM(分布式 COM)客户端运行,并允许 PHP 脚本在远程服务器上实例化 COM 对象。

com.autoregister_typelib

启用后,PHP 尝试从已实例化的 COM 对象的类型库中注册常量,前提是这些对象实现了获取信息所需的接口。注册的常量是否区分大小写,由 com.autoregister_casesensitive php.ini 控制。

com.autoregister_verbose

启用时,在对象实例化期间加载类型库出现的任何问题都会使用 PHP 的错误机制报告。默认为 off,如果查找或者加载类库出现错误则不会发出任何指示。

com.autoregister_casesensitive

启用时(默认),实例化 COM 对象时,在自动加载类型库中找到的常量将区分大小写进行注册。有关详细信息,请参阅 com_load_typelib()

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.

com.dotnet_version

用于 dotnet 对象的 .NET 框架版本。设置的值是框架版本号的前三部分,以点分隔,并以 v 作为前缀,例如 v4.0.30319

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.

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top