I have a filemanager that uses a config.inc.php file. I'm wondering how to use a predefined variable in this file, but i have no idea how.
I would like to know how this syntax is called and how i can use a variable.
;<?php/* do not delete this line!
[FTP]
; FTP access; leave empty to use local file system instead
ftpHost = "127.0.0.1" ; FTP server name
ftpUser = "test" ; FTP user name
ftpPassword = "test" ; FTP password
ftpPort = 21 ; FTP port number (default is 21)
ftpPassiveMode = yes ; use passive mode
ftpSSL = no ; use FTPS
; do not delete this line! */?>
It looks like an INI
file that is protected by PHP tags and readed with parse_ini_file
add after:
ftpSSL = no ; use FTPS
this:
customVar = "var" ; custom variable
You can add other variables but I don't think you can assign one from outside.
Have a look at the parse_ini_file function: http://php.net/manual/en/function.parse-ini-file.php
This will convert the input file to an array which can be easily queried.
For example:
$ini = parse_ini_file("config.inc.php");
print_r($ini);