I am writing a PHP library and increasing its portability and reliability. I would like to read the php.ini file to access the installation settings.
Is there an easy way to do this, or do I need to do it in a complicated way and write code to parse it myself?
thanks
I doubt you need the all php.ini file. For specific values, why not use ini_get() ? For example, to get the maximum message size, you can simply use:
ini_get()
$maxPostSize = ini_get('post_max_size');
PHP has nice support for INI files. Along with php_ini_loaded_file() you can get information about the current ini file.
php_ini_loaded_file()
<?php // get path to the ini file $inipath = php_ini_loaded_file(); // Parse with sections $ini_array = parse_ini_file($inipath , true); print_r($ini_array); ?>
http://php.net/manual/en/function.parse-ini-file.php
http://php.net/manual/en/function.php-ini-loaded-file.php
Source: https://habr.com/ru/post/1487246/More articles:Explicit method generation and signature - javaHow to call a function without arguments in V8? - c ++open android calendar with html link - androidHow can I open a calendar from my application? - javaI want to open the Calendar application from an Android application - androidAttach two timelines / list of tuples - pythonSwitching to another route when accessing the top resource, but not when accessing the nested route - ember.jsHow to continue a SQL query when an error is detected? - sqlstatic var and functions: memory allocation in php - phpExecuting code from a text field on the fly - c #All Articles