get_var_cfg(): 取的值是配置文件中的值
ini_get():
则取的当前值
比如
ini_set('SMTP', '192.160.0.24'); // 改变 SMTP 的当前值
print get_cfg_var('SMTP'); // 返回 localhost
print ini_get('SMTP'); // 返回 192.160.0.24
比如
ini_set('SMTP', '192.160.0.24'); // 改变 SMTP 的当前值
print get_cfg_var('SMTP'); // 返回 localhost
print ini_get('SMTP'); // 返回 192.160.0.24
下面引用手册:
get_cfg_var returns the value from php.ini directly,while the ini_get returns the runtime config value. I have tried it on PHP 5.1.6
I have found this useful for changing the error reporting levels for a few specific pages while testing. I turn on all error_reporting while testing, but for a few pages I want to turn off notices. So, I put this at the top of the page:
<?php
error_reporting(8183);
?>
and this at the bottom:
<?php
error_reporting(get_cfg_var('error_reporting'));
?>
to put it back to whatever default I had at the time.