User Tools

Site Tools


uphp:functions:ini_get

ini_get

WMPRO, WMMINI FW >= 1.0 WMMEGA FW >= 2.0

Get a value from an INI file

Description

mixed ini_get ( string $filename, string $section, string $key, mixed $default )

This function reads a configuration key value from an INI file. If the section and key are not found, the default value is returned.

Parameters

$filename: Full path and name of the INI file

$section: Name of the section inside the INI file

$key: Name of the key inside the section

$default: Value to be returned if the section and key are not found

Return Values

Mixed: Value associated with the key, or the default value if the section and key are not found

The value will be of type string, integer or float depending on the data type of the key value (or the data type of the default value if the section or key is not found).

Example

Get the network mask from the Wattmon network configuration file

<?
  $val=ini_get("/config/network.ini","network","netmask","255.255.255.0");
  print($val);
?>

See Also

ini_get_array() - Get a group of parameters from an INI file as an array

ini_put_array() - Write a group of parameters to an INI file from an array

ini_set() - Set a value in an INI file

uphp/functions/ini_get.txt · Last modified: 2021/09/13 05:57 (external edit)