File "gestion_configuration03.php"
Full Path: /home/analogde/www/Four/Monsta-FTP-master/gestion_configuration03.php
File size: 1.43 KB
MIME-type: text/x-php
Charset: utf-8
<?php
/*session_start();
$session_keys = array("pdf_mode1", "pdf_mode2" );
foreach($session_keys as $session_key)
{
if (!isset($_SESSION[$session_key]))
$_SESSION[$session_key] = '';
}
*/
function readOptionsFile($filePath)
{
if (!file_exists($filePath))
{
die("Erreur : Le fichier '$filePath' n'existe pas.");
}
if ($file = fopen( $filePath, "r"))
{
$options1 = []; // Tableau pour stocker les options
$options2 = [];
while(!feof($file))
{
$line = fgets($file);
//echo $line ."<br>";
// premiere solution
list($key, $value) = explode('=', $line, 2);
$key = trim($key);
$value = trim($value);
$options1[$key] = $value;
// seconde solution
$parts = explode('=', $line, 2);
//echo $parts[0] ." " .$parts[1] ."<br>";
if (count($parts) == 2)
{
$key = trim($parts[0]); // Clé
$value = trim($parts[1]); // Valeur
$options2[$key] = $value;
}
}
//print_r($options1);
//echo "<br>";
//print_r($options2);
fclose($file);
return( $options2);
}
}
// Chemin du fichier des options
//$filePath = 'settings.cfg';
// Lire les options du fichier
//$options = readOptionsFile($filePath);
?>