您好我正在我的网站上建立一个论坛。我将依赖文件存储在我的服务器上:“includes / mod_forum / foum”
我的index.php页面存储在初始目录中(在“inlcudes /../ ..”之前)有一个链接到文件forum.php与index.php位于同一本地目录中。
在forum.php文件中,我设置了一个include函数:“<?php include('includes/mod_forum/forum/index.php'); ?>
”
index.php文件和存储在“includes / mod_forum / forum /”中的名为post.php的文件都需要连接到我的sql数据库。
设置数据库凭据的文件存储在“includes / _config / connection.php”中。
当我访问直接存储在“includes / mod_forum / forum /”的index.php文件时,它发现connection.php文件正常并连接到我的数据库但是当我访问本地/主目录中的forum.php时(之前) “inlcudes /../ ..”)它无法找到连接数据库的connection.php文件。
为什么会这样?
希望我已经解释过这个。
接下来我得到的错误:
Warning: include(../../_config/connection.php) [function.include]: failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/PTB1/includes/mod_forum/forum/index.php on line 252
Warning: include() [function.include]: Failed opening '../../_config/connection.php' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php:/Applications/XAMPP/xamppfiles/lib/php/pear') in /Applications/XAMPP/xamppfiles/htdocs/PTB1/includes/mod_forum/forum/index.php on line 252
Warning: include(../../_config/connection.php) [function.include]: failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/PTB1/includes/mod_forum/forum/posts.php on line 2
Warning: include() [function.include]: Failed opening '../../_config/connection.php' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php:/Applications/XAMPP/xamppfiles/lib/php/pear') in /Applications/XAMPP/xamppfiles/htdocs/PTB1/includes/mod_forum/forum/posts.php on line 2
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/PTB1/includes/mod_forum/forum/posts.php on line 122