2014-10-31 17 views
-3
[31-Oct-2014 12:47:24 UTC] PHP Warning: include_once(../connect/con.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory in /home/denzw681/public_html/u/userPages/check_login_status.php on line 3 
[31-Oct-2014 12:47:24 UTC] PHP Warning: include_once() [<a href='function.include'>function.include</a>]: Failed opening '../connect/con.php' for inclusion (include_path='.:/opt/alt/php53/usr/share/pear:/opt/alt/php53/usr/share/php') in /home/denzw681/public_html/u/userPages/check_login_status.php on line 3 
[31-Oct-2014 12:47:24 UTC] PHP Notice: Undefined variable: con in /home/denzw681/public_html/u/userPages/check_login_status.php on line 26 
[31-Oct-2014 12:47:24 UTC] PHP Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /home/denzw681/public_html/u/userPages/check_login_status.php on line 15 
[31-Oct-2014 12:47:24 UTC] PHP Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in /home/denzw681/public_html/u/userPages/check_login_status.php on line 16 

我的文件夾是這樣的:PHP MYSQL方向誤差

>>的public_html/U /連接/ con.php

>>的public_html/U/userPages/check_login_status.php

>>的public_html/U/userPages/php_parsers/photo_system.php

不知道如何解決這個問題(

我可以添加文件代碼,如果需要回答這個問題。

P.S.網站是http://www.U.example.com/

回答

0

你可以嘗試使用你的網站的根目錄,具有:

include_once($_SERVER['DOCUMENT_ROOT']."/u/connect/con.php"); 

或者你可以使用魔術常量:

define('ROOT_PATH', dirname(dirname(__FILE__))); 
+0

w ebsite是http://www.U.example.com/ – Denis 2014-10-31 13:41:19

+0

然後Rakesh的回答非常好。我使用魔法改進了一點__FILE__ – 2014-10-31 13:46:03

+0

酷...這有助於...)最佳答案 – Denis 2014-10-31 13:46:11

0

你給連接的正確路徑嘗試

include_once('../../connect/con.php'); 

,或者在共同文件中定義您的網站的網址類似的header.php

define('SITEURL', 'http://example.com/u/'); 

,並使用此效果會更好包含文件

include_once(SITEURL.'connect/con.php'); 
+0

壞主意...嘗試過它,完整的網站不起作用... – Denis 2014-10-31 13:37:29

+0

檢查更新的答案 – 2014-10-31 13:39:59

+0

網站根本不起作用...不只是特定頁面 – Denis 2014-10-31 13:44:53