Function.ini-get

Aus PHP-Wiki

Wechseln zu: Navigation, Suche
Unfallversicherung und Fragen & Antworten: FinanzenRisiko-Lebensversicherung Vergleichen Online - Risikolebens- vs. Kapitallebensversicherung . Handy Tarife

ini_get — Gets the value of a configuration option

Inhaltsverzeichnis

Beschreibung

string ini_get ( string $varname )


Returns the value of the configuration option on success.

Parameter-Liste

varname
  • The configuration option name.

Rückgabewerte

Returns the value of the configuration option as a string on success, or an empty string on failure or for null values.

Beispiele

=== #1 A few ini_get() examples

<?php
/*
Our php.ini contains the following settings:
 
display_errors = On
register_globals = Off
post_max_size = 8M
*/
 
echo 'display_errors = ' . ini_get('display_errors') . "\n";
echo 'register_globals = ' . ini_get('register_globals') . "\n";
echo 'post_max_size = ' . ini_get('post_max_size') . "\n";
echo 'post_max_size+1 = ' . (ini_get('post_max_size')+1) . "\n";
echo 'post_max_size in bytes = ' . return_bytes(ini_get('post_max_size'));
 
function return_bytes($val) {
    $val = trim($val);
    $last = strtolower($val[strlen($val)===
 
 
 
 
 
 
 
 
 
 
==Anmerkungen==
 
 
  Hinweis: 
   '''When querying boolean values'''<br />
 
    A boolean ini value of ''off'' will be returned as an
    empty string or &quot;0&quot; while a boolean ini value of ''on'' will
    be returned as &quot;1&quot;.
    The function can also return the literal string of INI value.
   <br />
 
  Hinweis: 
   '''When querying memory size values'''<br />
 
    Many ini memory size values, such as
    [[ini.sect.file-uploads.php#ini.upload-max-filesize|upload_max_filesize]], are
    stored in the php.ini file in shorthand notation.
    '''ini_get()''' will return the exact string stored in the
    php.ini file and NOT its [[language.types.integer|integer]]
    equivalent.  Attempting normal arithmetic functions on these values
    will not have otherwise expected results.  The example above shows one
    way to convert shorthand notation into bytes, much like how the PHP
    source does it.
   <br />
 
 
 
 
 
 
==Siehe auch==
* [[function.get-cfg-var|get_cfg_var()]]
* [[function.ini-get-all|ini_get_all()]]
* [[function.ini-restore|ini_restore()]]
* [[function.ini-set|ini_set()]]
 
[[Kategorie:PHP 4|I]]
[[Kategorie:PHP 5|I]]
[[Kategorie:PHP Options/Info Funktionen|I]]
Persönliche Werkzeuge