get_cfg_var vs ini_get

由 joelhy 于 周四, 04/10/2008 - 14:51 提交。
  1. get_cfg_var() shows php.ini setting
  2. ini_get() shows current setting

get_cfg_var() is an old PHP 3.0 era function, that returns the value for a directive in the php.ini file. This value may be valid or invalid, depending on whether it was overwritten by other configuration methods (e.g., httpd.conf or .htaccess). This function will always return the value that was typed in php.ini, if any.

ini_get() is a new PHP 4.0 function, that uses the new INI subsystem introduced in 4.0. It will always return the active value, and not necessarily the value that was in the php.ini. Generally, unless you're writing a script that actually deals with the php.ini file, you should always use this function and not get_cfg_var().

发表新评论

此内容将保密,不会被其他人看见。
  • 网页地址和电子邮件地址将会被自动转换为链接。
  • 允许的 HTML 标签: <img> <p> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <coolcode>
  • You can use coolfilter tags in the text, to include code and media

更多格式化选项信息