parse_ini_file

parse_ini_file -- Parse a configuration file

Description

array parse_ini_file ( string filename [, bool process_sections])

הערה :

הערה :

אזהרה

If the ini file you are trying to parse is malformed , PHP will exit .

דוגמה 1 .

 
;

 
This

 
is

 
a

 
sample

 
configuration

 
file

 
;

 
Comments

 
start

 
with

 
'

 
;'

 
,

 
as

 
in

 
php.ini

 
[first_section

 
]

 
one

 
=

 
1

 
five

 
=

 
5

 
[second_section

 
]

 
path

 
=

 
/

 
usr

 
/

 
local

 
/

 
bin





דוגמה 2 . parse_ini_file( ) example

 
?php

 
/

 
/

 
Parse

 
without

 
sections

 
$ini_array

 
=

 
parse_ini_file(

 
"sample.ini")

 
;

 
print_r($ini_array)

 
;

 
/

 
/

 
Parse

 
with

 
sections

 
$ini_array

 
=

 
parse_ini_file("sample.ini"

 
,

 
TRUE)

 
;

 
print_r($ini_array)

 
;

 

?





 
Array

 
(

 
[one

 
]

 
=

 
1

 
[five

 
]

 
=

 
5

 
[path

 
]

 
=

 
/

 
usr

 
/

 
local

 
/

 
bin

 
)

 
Array

 
(

 
[first_section

 
]

 
=

 
Array

 
        (

 
[one

 
]

 
=

 
1

 
[five

 
]

 
=

 
5

 
        )

 
[second_section

 
]

 
=

 
Array

 
        (

 
[path

 
]

 
=

 
/

 
usr

 
/

 
local

 
/

 
bin

 
        )

 

)