array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.ini-set.php', 1 => 'ini_set', ), 'up' => array ( 0 => 'ref.info.php', 1 => 'PHP 选项/信息 函数', ), 'prev' => array ( 0 => 'function.ini-restore.php', 1 => 'ini_restore', ), 'next' => array ( 0 => 'function.memory-get-peak-usage.php', 1 => 'memory_get_peak_usage', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/info/functions/ini-set.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
ini_set — 为一个配置选项设置值
设置指定配置选项的值。这个选项会在脚本运行时保持新的值,并在脚本结束时恢复。
成功时返回旧的值,失败时返回 false
。
示例 #1 设置一个 ini 选项
<?php
echo ini_get('display_errors');
if (!ini_get('display_errors')) {
ini_set('display_errors', '1');
}
echo ini_get('display_errors');
?>