我正在尝试访问托管在我的服务器上的文件,该文件位于 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
最佳答案
试试这个:
$config = parse_ini_file(dirname($_SERVER['DOCUMENT_ROOT'])."/credentials.ini");
关于php - $_SERVER ['DOCUMENT_ROOT'] 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32652912/