PHP无法连接到数据库配置

问题描述 投票:-2回答:1

我有这样的文件夹结构:

|Home

|____|Admin

|__________|Pages

|

|

|db_config.php

位于主目录中的文件,我将连接设置为db_config.php文件,如下所示:include("db_config.php");

对于位于pages目录中的文件,我设置为:

include("..\\..\\db_config.php");

这个设置在我的本地工作正常,当我将我的网站上传到000webhost时不起作用。我该怎么做才能解决这个问题?谢谢

php mysql database phpmyadmin config
1个回答
3
投票

简单地改变

include("..\..\db_config.php");

include("../../db_config.php");

\只适用于Windows,Linux使用/(您的主机可能正在使用)BTW,总是使用/,Windows也接受它。

© www.soinside.com 2019 - 2024. All rights reserved.