putenv Sets the value of an environment variable php函数


putenv

(PHP 4, PHP 5)

putenvSets the value of an environment variable

说明

bool putenv ( string $setting )

Adds setting to the server environment. The environment variable will only exist for the duration of the current request. At the end of the request the environment is restored to its original state.

Setting certain environment variables may be a potential security breach. The safe_mode_allowed_env_vars directive contains a comma-delimited list of prefixes. In Safe Mode, the user may only alter environment variables whose names begin with the prefixes supplied by this directive. By default, users will only be able to set environment variables that begin with PHP_ (e.g. PHP_FOO=BAR). Note: if this directive is empty, PHP will let the user modify ANY environment variable!

The safe_mode_protected_env_vars directive contains a comma-delimited list of environment variables, that the end user won't be able to change using putenv(). These variables will be protected even if safe_mode_allowed_env_vars is set to allow to change them.

参数

setting

The setting, like "FOO=BAR"

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE.

范例

Example #1 Setting an environment variable

<?php
putenv
("UNIQID=$uniqid");
?>

注释

Warning

The safe_mode_allowed_env_vars and safe_mode_protected_env_vars directives only take effect when safe_mode is enabled.

参见

  • getenv() - Gets the value of an environment variable



相关阅读:
quoted_printable_decode Convert a quoted-printable string to an 8 bit string
quoted_printable_encode Convert a 8 bit string to a quoted-printable string
quotemeta Quote meta characters
rad2deg 将弧度数转换为相应的角度数
rand 产生一个随机整数
range 建立一个包含指定范围单元的数组
rawurldecode 对已编码的 URL 字符串进行解码
rawurlencode 按照 RFC 1738 对 URL 进行编码
readdir 从目录句柄中读取条目
readfile 输出一个文件
readgzfile Output a gz-file
readline Reads a line
readline_add_history Adds a line to the history
readline_callback_handler_install Initializes the readline callback interface and terminal, prints the prompt and returns immediately
快速导航

Copyright © 2016 phpStudy |