Array to ini file php


 
Author
 
Name:Classes:Country:Age:All time rank:Week rank:
Radovan Janjic is available for providing paid consulting. Contact Radovan Janjic .
14 packages by Radovan Janjic
Serbia
34
248 2 in Serbia
40
1 in Serbia
Innovation award

Nominee: 3x

This class can read and write configuration values in INI files.

It can parse a given INI file and extract the contained configuration values into class array variables.

The class can also do the opposite, i.e., write the configuration values in the array variable back to a INI file.


Details

PHP_INI_Read_Write

This class can read and write configuration values in INI files.

It can parse a given INI file and extract the contained configuration values into class array variables.

The class can also do the opposite, i.e., write the configuration values in the array variable back to a INI file.

Examples:

// Parse config.ini $ini = new INI('config.ini'); // Content of: config.ini print_r($ini->data); // Udate settings $ini->data['first_section']['animal'] = 'COW'; // Save settings to file $ini->write(); // Update settings $ini->data['first_section']['animal'] = 'HORSE'; // Add new setting to section third_section $ini->data['third_section']['phpversion'][] = 5.4; // Add new section third_section and new item something $ini->data['fourth_section']['something'] = 'some data'; // Save settings to new file $ini->write('config-2.ini'); // INI obj is now using ini 2 file // Content of: config-2.ini print_r($ini->data); // Parse config.ini $ini->read('config.ini'); // Remove item from second_section unset($ini->data['second_section']['URL']); // Remove third_section from second ini file and save to third file unset($ini->data['third_section']); // Save settings to new file $ini->write('config-3.ini'); // INI obj is now using ini 3 file // Content of: config-3.ini print_r($ini->data);


  Classes of Radovan Janjic  >  PHP INI Read and Write Class  > 
Download .zip .tar.gz
 > 
Support forum (1)
 > 
Blog
 > 
Latest changes
 

Name:Base name:Description:Version:PHP version:License:All time users:All time rank:Week users:Week rank:
PHP INI Read and Write Class

Support forum

php-ini-class
Read and write configuration values in INI files
1.1
4.0.4
GNU General Public License (GPL)
1271 users
3009
0 users
142
 

  Groups  
User ratings
  Applications  
Files
 

  Applications that use this package  

No pages of applications that use this class were specified.

If you know an application of this package, send a message to the author to add a link here.

 
Files
 

How do I write data into an INI file?

Line 1: Load the file into an array. Line 2: set the value. Next lines: Compile ini file content. Last line: write content to disk.

How do I create a PHP INI file?

How to Manually Create a PHP..
Log into your cPanel account..
Open your File Manager..
Navigate to your public_html directory..
Create a new file..
Name it php.ini..
Edit the php.ini file you just created..
Copy and Paste the default php. ini code from the copy of the default version below..
Click Save Changes..

How do I output an array to a file?

We can create an array and use print_r() function to return the array and use the fwrite() function to write the array to the file. The print_r() function takes the array to be printed and the boolean value as the parameters. Use the fopen() function to create a file file.

What is INI file in PHP?

The php. ini file is the default configuration file for running applications that require PHP. It is used to control variables such as upload sizes, file timeouts, and resource limits. php. ini file is the configuration file.

Postingan terbaru

LIHAT SEMUA