天天看点

ini_set 为一个配置选项设置值

ini_set

(PHP 4, PHP 5)

ini_set — 为一个配置选项设置值

string ini_set ( string $varname , string $newvalue )

设置指定配置选项的值。这个选项会在脚本运行时保持新的值,并在脚本结束时恢复。

参数:

varname

   不是所有有效的选项都能够用 ini_set() 来改变的。 这里有个有效选项的清单附录。

newvalue

   选项新的值。

返回值:

成功时返回旧的值,失败时返回 FALSE。

例子:

<code>&lt;?php</code>

<code>echo</code> <code>ini_get</code><code>(</code><code>'display_errors'</code><code>);</code><code>//ini_get() - 获取一个配置选项的值</code>

<code>if</code> <code>(!</code><code>ini_get</code><code>(</code><code>'display_errors'</code><code>)) {</code>

<code>    </code><code>ini_set</code><code>(</code><code>'display_errors'</code><code>, </code><code>'1'</code><code>);</code>

<code>}</code>

<code>echo</code> <code>ini_get</code><code>(</code><code>'display_errors'</code><code>);</code>

<code>?&gt;</code>

这里有个有效选项的清单附录:

php.ini 配置选项列表

可以在 php.ini 中使用下列配置选项对 PHP 进行配置。

“可修改范围”列决定了该配置选项在什么情况下可以被设置。查看配置可被设定范围列表查看具体定义。

axis2.enable_exception"1"PHP_INI_ALL

axis2.enable_trace"1"PHP_INI_ALL

axis2.log_path"/tmp"PHP_INI_ALL

bcompiler.enabled"1"PHP_INI_ALL从 bcompiler 0.8 起可用。birdstep.max_links"-1"PHP_INI_ALL从 PHP 4.2.0 起可用。blenc.key_file"/usr/local/etc/blenckeys"PHP_INI_ALL

daffodildb.default_password"daffodil"PHP_INI_ALL

daffodildb.default_socketNULLPHP_INI_ALL

daffodildb.default_user"DAFFODIL"PHP_INI_ALL

daffodildb.port"3456"PHP_INI_ALL

etpan.default.charset"utf-8"PHP_INI_ALL

etpan.default.protocol"imap"PHP_INI_ALL

htscanner.default_docroot"/"PHP_INI_SYSTEM

imlib2.font_cache_max_size"524288"PHP_INI_ALL

imlib2.font_path"/usr/share/php/fonts/"PHP_INI_ALL

mssql.allow_persistent"1"PHP_INI_SYSTEM

mssql.batchsize"0"PHP_INI_ALL从 PHP 4.0.4 起可用。mssql.charset""PHP_INI_ALL从 PHP 5.1.2 起可用。mssql.compatability_mode"0"PHP_INI_ALL

mssql.connect_timeout"5"PHP_INI_ALL

mssql.datetimeconvert"1"PHP_INI_ALL从 PHP 4.2.0 起可用。mssql.max_links"-1"PHP_INI_SYSTEM

mssql.max_persistent"-1"PHP_INI_SYSTEM

mssql.max_procs"-1"PHP_INI_ALL从 PHP 4.3.0 起可用。mssql.min_error_severity"10"PHP_INI_ALL

mssql.min_message_severity"10"PHP_INI_ALL

mssql.secure_connection"0"PHP_INI_SYSTEM从 PHP 4.3.0 起可用。mssql.textlimit"-1"PHP_INI_ALL

mssql.textsize"-1"PHP_INI_ALL

namazu.langNULLPHP_INI_ALL

namazu.loggingmode"0"PHP_INI_ALL

namazu.sortmethodNULLPHP_INI_ALL

namazu.sortorderNULLPHP_INI_ALL

odbtp.datetime_format"object"PHP_INI_ALL

odbtp.detach_default_queries"0"PHP_INI_ALL

odbtp.guid_format"string"PHP_INI_ALL从 odbtp 1.1.3 起可用。odbtp.interface_file"/usr/local/share/odbtp.conf"PHP_INI_ALL

odbtp.truncation_errors"1"PHP_INI_ALL

opendirectory.default_separator"/"PHP_INI_ALL在 opendirectory 0.2.2 中移除该选项。opendirectory.max_refs"-1"PHP_INI_ALL

printer.default_printer""PHP_INI_ALL从 PHP 4.0.6 起可用。 在 PHP 4.1.1 中移除该选项。python.append_path""PHP_INI_ALL

python.prepend_path"."PHP_INI_ALL

session_pgsql.db"host=localhost dbname=php_session user=nobody"PHP_INI_SYSTEM

session_pgsql.disable"0"PHP_INI_SYSTEM

session_pgsql.failover_mode"0"PHP_INI_SYSTEM

session_pgsql.gc_interval"3600"PHP_INI_SYSTEM

session_pgsql.keep_expired"0"PHP_INI_SYSTEM

session_pgsql.sem_file_name"/tmp/php_session_pgsql"PHP_INI_SYSTEM

session_pgsql.serializable"0"PHP_INI_SYSTEM

session_pgsql.short_circuit"0"PHP_INI_SYSTEM

session_pgsql.use_app_vars"0"PHP_INI_SYSTEM

session_pgsql.vacuum_interval"21600"PHP_INI_SYSTEM

simple_cvs.compressionLevel"0"PHP_INI_ALL

simple_cvs.cvsRoot"0"PHP_INI_ALL

simple_cvs.host"0"PHP_INI_ALL

simple_cvs.moduleName"0"PHP_INI_ALL

simple_cvs.userName"0"PHP_INI_ALL

simple_cvs.workingDir"0"PHP_INI_ALL

user_ini.cache_ttl"300"PHP_INI_SYSTEM从 PHP 5.3.0 起可用。user_ini.filename".user.ini"PHP_INI_SYSTEM从 PHP 5.3.0 起可用。valkyrie.auto_validate"0"PHP_INI_ALL

valkyrie.config_pathNULLPHP_INI_ALL

xdebug.collect_includes"1"PHP_INI_ALL从 Xdebug 2.0.0 起可用。xdebug.collect_params"0"PHP_INI_ALL

xdebug.collect_return"0"PHP_INI_ALL从 Xdebug 2.0.0 起可用。xdebug.collect_vars"0"PHP_INI_ALL从 Xdebug 2.0.0 起可用。xdebug.default_enable"1"PHP_INI_ALL在 Xdebug 1 时是 PHP_INI_SYSTEM。xdebug.dump.COOKIENULLPHP_INI_ALL

xdebug.dump.ENVNULLPHP_INI_ALL

xdebug.dump.FILESNULLPHP_INI_ALL

xdebug.dump.GETNULLPHP_INI_ALL

xdebug.dump.POSTNULLPHP_INI_ALL

xdebug.dump.REQUESTNULLPHP_INI_ALL

xdebug.dump.SERVERNULLPHP_INI_ALL

xdebug.dump.SESSIONNULLPHP_INI_ALL

xdebug.dump_globals"1"PHP_INI_ALL从 Xdebug 2.0.0 起可用。xdebug.dump_once"1"PHP_INI_ALL

xdebug.dump_undefined"0"PHP_INI_ALL

xdebug.extended_info"1"PHP_INI_SYSTEM从 Xdebug 2.0.0 起可用。xdebug.idekey""PHP_INI_ALL从 Xdebug 2.0.0 起可用。xdebug.manual_url"http://www.php.net"PHP_INI_ALL

xdebug.max_nesting_level"100"PHP_INI_ALL

xdebug.output_dir"/tmp"PHP_INI_PERDIR在 Xdebug &lt;= 1.2.0 时是 PHP_INI_SYSTEM。 在 Xdebug 2.0.0 中移除该选项。xdebug.profiler_aggregate"0"PHP_INI_PERDIR从 Xdebug 2.0.0 起可用。xdebug.profiler_append"0"PHP_INI_PERDIR从 Xdebug 2.0.0 起可用。xdebug.profiler_enable"0"PHP_INI_PERDIR从 Xdebug 2.0.0 起可用。xdebug.profiler_enable_trigger"0"PHP_INI_PERDIR从 Xdebug 2.0.0 起可用。xdebug.profiler_output_dir"/tmp"PHP_INI_PERDIR从 Xdebug 2.0.0 起可用。xdebug.profiler_output_name"cachegrind.out.%p"PHP_INI_PERDIR从 Xdebug 2.0.0 起可用。xdebug.remote_autostart"0"PHP_INI_ALL从 Xdebug 2.0.0 起可用。xdebug.remote_enable"0"PHP_INI_PERDIR

xdebug.remote_handler"dbgp"PHP_INI_ALL

xdebug.remote_host"localhost"PHP_INI_ALL

xdebug.remote_log""PHP_INI_ALL从 Xdebug 2.0.0 起可用。xdebug.remote_mode"req"PHP_INI_ALL

xdebug.remote_port"9000"PHP_INI_ALL

xmms.session"0"PHP_INI_ALL

      本文转自许琴 51CTO博客,原文链接:http://blog.51cto.com/xuqin/1202662,如需转载请自行联系原作者