我正在尝试访问我的服务器上托管的文件,offcourse在public_html文件夹之外。访问ini文件的代码如下:
$config = parse_ini_file($_SERVER['DOCUMENT_ROOT']."../credentials.ini");
$connection = mysql_connect("localhost",$config['username'],$config['password']);
错误:
Warning: parse_ini_file(/home2/gaurav/public_html/fantacy.co.in../credentials.ini): failed to open stream: No such file or directory in /home2/gaurav/public_html/fantacy.co.in/DB_CONNECT.php on line 23
答案 0 :(得分:2)
您错过了 /
$config = parse_ini_file($_SERVER['DOCUMENT_ROOT'] . "/../credentials.ini");
答案 1 :(得分:2)
试试这个:
$config = parse_ini_file(dirname($_SERVER['DOCUMENT_ROOT'])."/credentials.ini");