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

前端之家收集整理的这篇文章主要介绍了在上面的文件夹中包含.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.

基本上在cms文件夹中是config.PHP,我想包括“../config.PHP”;会做的伎俩,但它看起来如此.

尝试计算绝对路径包括它.
include(dirname(__FILE__)."/../config.PHP");

我认为这是处理多层次包含时最安全的选择.

猜你在找的PHP相关文章