KillerKode
KillerKode

Reputation: 997

PHP parse_ini_file relative path?

I have this code:

$test = parse_ini_file("../data/test.ini");

test.ini is located back one directory and then forwards into the data folder. But the problem I'm getting is parse_ini_file doesn't like when I make this relative link to the file, can anyone help me do this without making a absolute link to the file?

Upvotes: 9

Views: 6044

Answers (1)

Matteo Tassinari
Matteo Tassinari

Reputation: 18584

You could try this:

$test = parse_ini_file(realpath("../data/test.ini"));

See this link

Or you could just use the absolute path directly.

Upvotes: 4

Related Questions