在上面的文件夹中包含.php文件

use*_*273 7 php

我收到此错误

Warning: include(../config.php) [function.include]: failed to open stream: No such file or directory in /home/soizastu/public_html/cms/happy-api/retrieve.php on line 2

Warning: include() [function.include]: Failed opening '../config.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/soizastu/public_html/cms/happy-api/retrieve.php on line 2

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'soizastu'@'localhost' (using password: NO) in /home/soizastu/public_html/cms/happy-api/retrieve.php on line 6
Error connecting to database.
Run Code Online (Sandbox Code Playgroud)

基本上在cms文件夹中是config.php我认为include "../config.php";会做的伎俩,但它看起来如此.

Ali*_*aru 28

尝试计算绝对路径并包括它.

include(dirname(__FILE__)."/../config.php");
Run Code Online (Sandbox Code Playgroud)

我认为在处理多个级别的包含时,这是最安全的选择.