putenv

(PHP 4, PHP 5, PHP 7, PHP 8)

putenvSets the value of an environment variable

Опис

putenv(string $assignment): bool

Adds assignment 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.

Параметри

assignment

The setting, like "FOO=BAR"

Значення, що повертаються

Повертає true у разі успіху або false в разі помилки.

Приклади

Приклад #1 Setting an environment variable

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

Прогляньте також

  • getenv() - Повертає значення змінної оточення
  • apache_setenv() - Set an Apache subprocess_env variable