2013-10-16 65 views
0

問候的,我目前正在我的第一次嘗試開發一個登錄我的網站。對於這個登錄,我正在使用PHP和MySQL。我的問題是,我一直在接受下面的錯誤...我試過用盡所有可能性來重命名「require_once」輸入到我的知識中,但仍然知道運氣。PHP登錄:未能打開流:沒有這樣的文件

Warning: require_once(C:\Users\Derek\Fall_2013\PS-WebDesign\includes\constants.php) [function.require-once]: failed to open stream: No such file or directory in D:\Hosting\11311638\html\classes\Mysql.php on line 3 

Fatal error: require_once() [function.require]: Failed opening required 'C:\Users\Derek\Fall_2013\PS-WebDesign\includes\constants.php' (include_path='.;C:\php\pear') in D:\Hosting\11311638\html\classes\Mysql.php on line 3 

下面是正在生產的致命錯誤代碼行,我的問題是我有沒有正確調用文件或者是有代碼我的心中有氣無力缺少?誤差是3號線「require_once ......」

<?php 

require_once 'includes/constants.php'; 

class Mysql { 
    private $conn; 
    function __construct() { 
     $this->conn = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME) or die(
     'You ***'d up.'); 
    } 

    function verify_Username_and_Pass($un, $pwd) { 

     $query = "SELECT * 
     FROM users 
     WHERE username = ? AND password = ? 
     LIMIT 1"; 

     if($stmt = $this->conn->prepare($query)) { 
      $stmt->bind_param('ss', $un, $pwd); 
      $stmt->execute(); 

      if($stmt->fetch()) { 
       $stmt->close(); 
       return true; 
      } 
     } 
    } 
} 
+7

錯誤的很清楚。你正在嘗試「需要」的文件不存在:「沒有這樣的文件或目錄」。由於它不能被包含,需求正在做它應該做的事情並且殺死你的腳本。 –

+0

的要求路徑應該是相對於你的Apache目錄 – Joren

+0

的根,你有一個語法錯誤,你的'die' – Ibu

回答

0

是這包括在根目錄下的文件?

你也應該刪除上述include行空行。 Lsatly,對模具的語法應爲die(mysqli_error() 'You ***'d up.');

+0

此處有一個此常見錯誤的故障排除清單:https://stackoverflow.com/a/36577021/2873507 –

相關問題