I've joined to a new team/project and there is a .ini
file in the project which is used as the project configuration file. The content of it looks like:
[version]
v = 1
[paths]
website = http://localhost
base_url = /myweb/
images_path = C:\\xampp\\htdocs\\myweb\\img\\
attached_file_path = C:\\xampp\\htdocs\\myweb\\attached_files\\
[limitation values]
max_avatar_size = 2 ; MB
max_uploaded_image_size = 3 ; MB
max_uploaded_file_size = 4 ; MB
I can access those values like this: config('item_name')
, ie config('base_url')
which return /myweb/
. Noted that config()
function uses parse_ini_file()
function.
My question is, what are those section titles? ie [version]
, [paths]
.. ? Are they accessible? If yes, how?
The function parse_ini_file()
have a second argument : bool process_sections
.
$ini_array = parse_ini_file("sample.ini", true); // true means "process_sections"
// var_dump(array_keys($ini_array)) ;
var_dump($ini_array['paths']['base_url']) ;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.